package com.ruoyi.sim.domain;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 故障对象 sim_fault
 *
 * @author tom
 * @date 2025-01-02
 */
public class Fault extends BaseEntity implements Comparable<Fault> {
    private static final long serialVersionUID = 1L;

    /**
     * 故障ID
     */
    private String faultId;

    /**
     * 父故障ID
     */
    @Excel(name = "父故障ID")
    private String parentFaultId;

    /**
     * 关联的真实的/虚假的故障部位
     */
    @Excel(name = "关联的真实的/虚假的故障部位")
    private String refType330FaultId;

    /**
     * 关联的排除方法
     */
    @Excel(name = "关联的排除方法")
    private String refType4FaultId;

    /**
     * 故障类型:[1]:故障现象,[2]:可能原因,[3]:真实故障部位,[30]:虚假故障部位,[4]:排除方法,[5]:修复结论
     */
    @Excel(name = "故障类型:[1]:故障现象,[2]:可能原因,[3]:真实故障部位,[30]:虚假故障部位,[4]:排除方法,[5]:修复结论")
    private String faultType;

    /**
     * 模拟器类型
     */
    @Excel(name = "模拟器类型")
    private String simType;

    /**
     * 故障状态:[0]:启用,[5]:禁用
     */
    @Excel(name = "故障状态:[0]:启用,[5]:禁用")
    private String faultState;

    /**
     * 互斥所有故障ID逗号分割
     */
    @Excel(name = "互斥所有故障ID逗号分割")
    private String conflictFaultIds;

    /**
     * 是否是更换件:[1]:是,[0]:不是
     */
    @Excel(name = "是否是更换件:[1]:是,[0]:不是")
    private String replacePart;

    /**
     * 更换件名称
     */
    @Excel(name = "更换件名称")
    private String replaceName;

    /**
     * 名称
     */
    @Excel(name = "名称")
    private String name;

    /**
     * 绑定硬件通信报文
     */
    @Excel(name = "绑定硬件通信报文")
    private String bindHardwareMsg;

    /**
     * 显示顺序
     */
    @Excel(name = "显示顺序")
    private Long orderNum;

    public void setFaultId(String faultId) {
        this.faultId = faultId;
    }

    public String getFaultId() {
        return faultId;
    }

    public void setParentFaultId(String parentFaultId) {
        this.parentFaultId = parentFaultId;
    }

    public String getParentFaultId() {
        return parentFaultId;
    }

    public void setRefType330FaultId(String refType330FaultId) {
        this.refType330FaultId = refType330FaultId;
    }

    public String getRefType330FaultId() {
        return refType330FaultId;
    }

    public void setRefType4FaultId(String refType4FaultId) {
        this.refType4FaultId = refType4FaultId;
    }

    public String getRefType4FaultId() {
        return refType4FaultId;
    }

    public void setFaultType(String faultType) {
        this.faultType = faultType;
    }

    public String getFaultType() {
        return faultType;
    }

    public void setSimType(String simType) {
        this.simType = simType;
    }

    public String getSimType() {
        return simType;
    }

    public void setFaultState(String faultState) {
        this.faultState = faultState;
    }

    public String getFaultState() {
        return faultState;
    }

    public void setConflictFaultIds(String conflictFaultIds) {
        this.conflictFaultIds = conflictFaultIds;
    }

    public String getConflictFaultIds() {
        return conflictFaultIds;
    }

    public void setReplacePart(String replacePart) {
        this.replacePart = replacePart;
    }

    public String getReplacePart() {
        return replacePart;
    }

    public void setReplaceName(String replaceName) {
        this.replaceName = replaceName;
    }

    public String getReplaceName() {
        return replaceName;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setBindHardwareMsg(String bindHardwareMsg) {
        this.bindHardwareMsg = bindHardwareMsg;
    }

    public String getBindHardwareMsg() {
        return bindHardwareMsg;
    }

    public void setOrderNum(Long orderNum) {
        this.orderNum = orderNum;
    }

    public Long getOrderNum() {
        return orderNum;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("faultId", getFaultId())
                .append("parentFaultId", getParentFaultId())
                .append("refType330FaultId", getRefType330FaultId())
                .append("refType4FaultId", getRefType4FaultId())
                .append("faultType", getFaultType())
                .append("simType", getSimType())
                .append("faultState", getFaultState())
                .append("conflictFaultIds", getConflictFaultIds())
                .append("replacePart", getReplacePart())
                .append("replaceName", getReplaceName())
                .append("name", getName())
                .append("bindHardwareMsg", getBindHardwareMsg())
                .append("orderNum", getOrderNum())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }

    // -------------------------------- tom add  --------------------------------
    @Override
    public int compareTo(Fault o) {
        if (StringUtils.isNotEmpty(faultId)) {
            return faultId.compareTo(o.getFaultId());
        } else {
            return -1;
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        Fault fault = (Fault) o;

        return new EqualsBuilder().append(faultId, fault.faultId).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37).append(faultId).toHashCode();
    }

    public interface Type {
        /**
         * 故障现象
         */
        String GZXX = "1";
        /**
         * 可能原因
         */
        String KNYY = "2";
        /**
         * 真实故障部位
         */
        String REAL_GZBW = "3";
        /**
         * 虚假故障部位
         */
        String FAKE_GZBW = "30";
        /**
         * 排除方法
         */
        String PCFF = "4";
        /**
         * 修复结论
         */
        String XFJL = "5";
    }

    public interface State {
        String ENABLE = "0";
        String DISABLE = "5";
    }

    /**
     * "" 空字符串。
     */
    public static String ROOT_FAULT_ID = "";
}
