package com.its.pis.entity;

import com.its.app.utils.SysUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class TbVdsCtlrStts {

	private String VDS_CTLR_NMBR;
	private String UPDT_DT;
	private String CMNC_STTS_CD;
	private String PRNT_PWER_STTS_CD;	//	2	N	VARCHAR(7)	Y	NULL	출력 전원 상태 코드
	private String CBOX_DOOR_STTS_CD;
	private String FAN_STTS_CD;
	private String HETR_STTS_CD;
	private int    CBOX_TMPR;

	private int    SUB_CTLR_VAL;	//	7	N	NUMBER(3)	Y	0	부 제어기 값
	private int    INPT_VOLT;		//	9	N	NUMBER(3)	Y	0	입력 전압
	private int    PRNT_VOLT;		//	10	N	NUMBER(3)	Y	0	출력 전압

	private String FRONT_DOOR_STTS_CD;
	private String BACK_DOOR_STTS_CD;
	private String VIDEO_INPUT;

	public TbVdsCtlrStts() {
		initStts(false);
	}
	
	public void initStts(boolean isConnected) {
		String CMNC_STTS_CD = isConnected ? "CMS0" : "CMS1";
		
		this.UPDT_DT            = SysUtils.getSysTime();
		this.CMNC_STTS_CD       = CMNC_STTS_CD;
		this.PRNT_PWER_STTS_CD  = "PWS2";
		this.CBOX_DOOR_STTS_CD  = "CDS2";
		this.FAN_STTS_CD        = "PAS2";
		this.HETR_STTS_CD       = "HTS2";
		this.CBOX_TMPR          = 0;
		this.SUB_CTLR_VAL       = 0;
		this.INPT_VOLT          = 0;
		this.PRNT_VOLT          = 0;

        this.FRONT_DOOR_STTS_CD = "CDS2";
        this.BACK_DOOR_STTS_CD  = "CDS2";
        this.VIDEO_INPUT        = "VDI2";
	}
	public byte getSttsComm() {
		return CMNC_STTS_CD == "CMS0" ? (byte)0 : (byte)1;
	}
	public byte getSttsPrntPwer() {
		if (PRNT_PWER_STTS_CD == "PWS0") return (byte)0;
		if (PRNT_PWER_STTS_CD == "PWS1") return (byte)1;
		return (byte)2;
	}
	public byte getSttsVideoInput() {
		if (VIDEO_INPUT == "VDI0") return (byte)0;
		if (VIDEO_INPUT == "VDI1") return (byte)1;
		return (byte)2;
	}
	public byte getSttsHeater() {
		if (HETR_STTS_CD == "HTS0") return (byte)1;
		if (HETR_STTS_CD == "HTS1") return (byte)0;
		return (byte)2;
	}
	public byte getSttsFan() {
		if (FAN_STTS_CD == "PAS0") return (byte)1;
		if (FAN_STTS_CD == "PAS1") return (byte)0;
		return (byte)2;
	}
	public byte getSttsCboxDoor() {
		if (CBOX_DOOR_STTS_CD == "CDS1") return (byte)1;
		if (CBOX_DOOR_STTS_CD == "CDS0") return (byte)0;
		return (byte)2;
	}
	public byte getSttsBackDoor() {
		if (BACK_DOOR_STTS_CD == "CDS1") return (byte)1;
		if (BACK_DOOR_STTS_CD == "CDS0") return (byte)0;
		return (byte)2;
	}
	public byte getSttsFrontDoor() {
		if (FRONT_DOOR_STTS_CD == "CDS1") return (byte)1;
		if (FRONT_DOOR_STTS_CD == "CDS0") return (byte)0;
		return (byte)2;
	}
	public byte getSttsFanMode() {
		return (byte)0;
	}
	public byte getSttsFanRunTemp() {
		return (byte)0;
	}
	public byte getSttsHetrMode() {
		return (byte)0;
	}
	public byte getSttsHetrRunTemp() {
		return (byte)0;
	}
	public short getSttsTemp() {
		return (short)CBOX_TMPR;
	}

}
