package com.its.vms.dto;

import com.its.app.utils.SysUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.io.Serializable;

/**
 *  DTO Class
 */
@Data
public class TbVmsCtlrSttsDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long vmsCtlrNmbr;
    private String updtDt;
    private String cmncSttsCd;
    private String pwerSttsCd;
    private String modlSttsCd;
    private String cboxDoorSttsCd;
    private String fanSttsCd;
    private String hetrSttsCd;
    private Integer cboxTmpr;
    private Integer brghVal;
    private String commSttsCd;
    private String modlStts;
    private String pwerStts;

    public TbVmsCtlrSttsDto(Long vmsCtlrNmbr) {
        this.vmsCtlrNmbr = vmsCtlrNmbr;
        initUnknown();
    }

    public TbVmsCtlrSttsDto clone() {
        TbVmsCtlrSttsDto dto = new TbVmsCtlrSttsDto(this.vmsCtlrNmbr);
        dto.setUpdtDt(this.updtDt);
        dto.setCmncSttsCd(this.cmncSttsCd);
        dto.setPwerSttsCd(this.pwerSttsCd);
        dto.setModlSttsCd(this.modlSttsCd);
        dto.setCboxDoorSttsCd(this.cboxDoorSttsCd);
        dto.setFanSttsCd(this.fanSttsCd);
        dto.setHetrSttsCd(this.hetrSttsCd);
        dto.setCboxTmpr(this.cboxTmpr);
        dto.setBrghVal(this.brghVal);
        dto.setCommSttsCd(this.commSttsCd);
        dto.setModlStts(this.modlStts);
        dto.setPwerStts(this.pwerStts);
        return dto;
    }
    public void initStts(boolean isConnected) {
        if (isConnected) {
            initUnknown();
        } else {
            initError();
        }
    }
    public void initUnknown() {
        this.updtDt = SysUtils.getSysTime();
        this.cmncSttsCd = "CMS2";
        this.pwerSttsCd = "MOS2";
        this.modlSttsCd = "MOS2";
        this.cboxDoorSttsCd = "CDS2";
        this.fanSttsCd = "PAS2";
        this.hetrSttsCd = "HTS2";
        this.cboxTmpr = 0;
        this.brghVal = 0;
        this.commSttsCd = "CMS2";
        this.modlStts = "11111111111111111111";
        this.pwerStts = "11111111111111111111";
    }
    public void initError() {
        initUnknown();
        this.cmncSttsCd = "CMS1";
        this.commSttsCd = "CMS1";
    }

    public void initNormal() {
        initUnknown();
        this.cmncSttsCd = "CMS0";
        this.commSttsCd = "CMS0";
    }

    public void setStts(int frontDoor, int backDoor, int fan, int hetr, int rtu, int tmpr, int hmdt) {
    }
}
