package com.its.op.entity.its.rse;

import com.its.op.dto.its.rse.TbRseCtlrSttsDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * RSE 상태 현황 Entity Class
 */
@Getter
@Setter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("RSE 상태 현황")
@Entity
@Table(name = "TB_RSE_CTLR_STTS")
public class TbRseCtlrStts implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("RSE 제어기 번호")  // N NUMBER(10)
    @Id
    @Column(name = "RSE_CTLR_NMBR", nullable = false, columnDefinition = "NUMBER", length = 10)
    private Long rseCtlrNmbr;

    @ApiModelProperty("수집 일시")  // N VARCHAR2(14)
    @Column(name = "UPDT_DT", nullable = false, length = 14)
    private String updtDt;

    @ApiModelProperty("통신 상태 코드('CMS')")  // Y VARCHAR2(7)
    @Column(name = "CMNC_STTS_CD", length = 7)
    private String cmncSttsCd;

    @ApiModelProperty("제어 장치 상태")  // Y VARCHAR2(7)
    @Column(name = "CNTL_DEVC_STTS", length = 7)
    private String cntlDevcStts;

    @ApiModelProperty("안테나 1 상태")  // Y VARCHAR2(7)
    @Column(name = "ATN_1_STTS", length = 7)
    private String atn1Stts;

    @ApiModelProperty("안테나 2 상태")  // Y VARCHAR2(7)
    @Column(name = "ATN_2_STTS", length = 7)
    private String atn2Stts;

    @ApiModelProperty("안테나 3 상태")  // Y VARCHAR2(7)
    @Column(name = "ATN_3_STTS", length = 7)
    private String atn3Stts;

    @ApiModelProperty("안테나 4 상태")  // Y VARCHAR2(7)
    @Column(name = "ATN_4_STTS", length = 7)
    private String atn4Stts;

    @ApiModelProperty("안테나 1 동작")  // Y VARCHAR2(7)
    @Column(name = "ATN_1_MTNS", length = 7)
    private String atn1Mtns;

    @ApiModelProperty("안테나 2 동작")  // Y VARCHAR2(7)
    @Column(name = "ATN_2_MTNS", length = 7)
    private String atn2Mtns;

    @ApiModelProperty("안테나 3 동작")  // Y VARCHAR2(7)
    @Column(name = "ATN_3_MTNS", length = 7)
    private String atn3Mtns;

    @ApiModelProperty("안테나 4 동작")  // Y VARCHAR2(7)
    @Column(name = "ATN_4_MTNS", length = 7)
    private String atn4Mtns;

    @ApiModelProperty("함체 문 상태 코드('CDS')-앞문/뒷문상태가 모두닫힌경우 닫힘")  // Y VARCHAR2(7)
    @Column(name = "CBOX_DOOR_STTS_CD", length = 7)
    private String cboxDoorSttsCd;

    @ApiModelProperty("앞문 상태 코드('CDS')")  // Y VARCHAR2(7)
    @Column(name = "FRONT_DOOR_STTS_CD", length = 7)
    private String frontDoorSttsCd;

    @ApiModelProperty("뒷문 상태 코드('CDS')")  // Y VARCHAR2(7)
    @Column(name = "BACK_DOOR_STTS_CD", length = 7)
    private String backDoorSttsCd;

    @ApiModelProperty("팬 상태 코드('PAS')")  // Y VARCHAR2(7)
    @Column(name = "FAN_STTS_CD", length = 7)
    private String fanSttsCd;

    @ApiModelProperty("히터 상태 코드('HTS')")  // Y VARCHAR2(7)
    @Column(name = "HETR_STTS_CD", length = 7)
    private String hetrSttsCd;

    @ApiModelProperty("함체 온도")  // Y NUMBER(3)
    @Column(name = "CBOX_TMPR", columnDefinition = "NUMBER", length = 3)
    private Integer cboxTmpr;

    @ApiModelProperty("함체 습도")  // Y NUMBER(3)
    @Column(name = "CBOX_HMDT", columnDefinition = "NUMBER", length = 3)
    private Integer cboxHmdt;

    @ApiModelProperty("RTU 상태 코드('RTU')")  // Y VARCHAR2(7)
    @Column(name = "RTU_STTS_CD", length = 7)
    private String rtuSttsCd;

    public TbRseCtlrSttsDto toDto() {
        return TbRseCtlrSttsDto.builder()
                .rseCtlrNmbr(this.rseCtlrNmbr)
                .updtDt(this.updtDt)
                .cmncSttsCd(this.cmncSttsCd)
                .cntlDevcStts(this.cntlDevcStts)
                .atn1Stts(this.atn1Stts)
                .atn2Stts(this.atn2Stts)
                .atn3Stts(this.atn3Stts)
                .atn4Stts(this.atn4Stts)
                .atn1Mtns(this.atn1Mtns)
                .atn2Mtns(this.atn2Mtns)
                .atn3Mtns(this.atn3Mtns)
                .atn4Mtns(this.atn4Mtns)
                .cboxDoorSttsCd(this.cboxDoorSttsCd)
                .frontDoorSttsCd(this.frontDoorSttsCd)
                .backDoorSttsCd(this.backDoorSttsCd)
                .fanSttsCd(this.fanSttsCd)
                .hetrSttsCd(this.hetrSttsCd)
                .cboxTmpr(this.cboxTmpr)
                .cboxHmdt(this.cboxHmdt)
                .rtuSttsCd(this.rtuSttsCd)
                .build();
    }

}
