package com.ruoyi.sim.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
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;

import java.util.*;

/**
 * 模拟器对象 sim_sim
 *
 * @author tom
 * @date 2024-12-13
 */
public class Sim extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 模拟器ID
     */
    private Long simId;

    /**
     * 座ID
     */
    @Excel(name = "座ID")
    private Long seatId;

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

    /**
     * 模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用
     */
    @Excel(name = "模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用")
    private String simState;

    /**
     * 模拟器序列号
     */
    @Excel(name = "模拟器序列号")
    private String simSn;

    /**
     * 模拟器设备编号1~30
     */
    @Excel(name = "模拟器设备编号1~30")
    private String simNum;

    /**
     * 最后一次成功发送报文时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    // @Excel(name = "最后一次成功发送报文时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastSentTime;

    /**
     * 最后一次成功收到报文时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    // @Excel(name = "最后一次成功收到报文时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastReceivedTime;

    public void setSimId(Long simId) {
        this.simId = simId;
    }

    public Long getSimId() {
        return simId;
    }

    public void setSeatId(Long seatId) {
        this.seatId = seatId;
    }

    public Long getSeatId() {
        return seatId;
    }

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

    public String getSimType() {
        return simType;
    }

    public void setSimState(String simState) {
        this.simState = simState;
    }

    public String getSimState() {
        return simState;
    }

    public void setSimSn(String simSn) {
        this.simSn = simSn;
    }

    public String getSimSn() {
        return simSn;
    }

    public void setSimNum(String simNum) {
        this.simNum = simNum;
    }

    public String getSimNum() {
        return simNum;
    }

    public void setLastSentTime(Date lastSentTime) {
        this.lastSentTime = lastSentTime;
    }

    public Date getLastSentTime() {
        return lastSentTime;
    }

    public void setLastReceivedTime(Date lastReceivedTime) {
        this.lastReceivedTime = lastReceivedTime;
    }

    public Date getLastReceivedTime() {
        return lastReceivedTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("simId", getSimId())
                .append("seatId", getSeatId())
                .append("simType", getSimType())
                .append("simState", getSimState())
                .append("simSn", getSimSn())
                .append("simNum", getSimNum())
                .append("lastSentTime", getLastSentTime())
                .append("lastReceivedTime", getLastReceivedTime())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }

    // -------------------------------- tom add  --------------------------------
    /**
     * FZD04B
     */
    public static final String TYPE_0001 = "0001";
    /**
     * FZB006
     */
    public static final String TYPE_0002 = "0002";
    /**
     * 防化兵用毒剂报警器
     */
    public static final String TYPE_0003 = "0003";

    public static final Set<String> TYPE_SET = new HashSet<>(Arrays.asList(TYPE_0001, TYPE_0002, TYPE_0003));

    public static final String TYPE_0001_NAME = "FZD04B";
    public static final String TYPE_0002_NAME = "FZB006";
    public static final String TYPE_0003_NAME = "防化兵用毒剂报警器";

    public static final Map<String, String> TYPE_NAME_MAP = Map.ofEntries(
            Map.entry(TYPE_0001, TYPE_0001_NAME),
            Map.entry(TYPE_0002, TYPE_0002_NAME),
            Map.entry(TYPE_0003, TYPE_0003_NAME)
    );

    public interface State {
        String ENABLE_INIT = "0";
        String ONLINE = "1";
        String SIM_OFFLINE = "2";
        String GATEWAY_OFFLINE = "3";
        String SIM_ERROR = "4";
        String DISABLE = "5";
    }

    public static final Set<String> STATE_SET = new HashSet<>(Arrays.asList(
            State.ENABLE_INIT,
            State.ONLINE,
            State.SIM_OFFLINE,
            State.GATEWAY_OFFLINE,
            State.SIM_ERROR,
            State.DISABLE
    ));
}
