package com.its.op.entity.its.vms;

import com.its.op.dto.its.vms.TbVmsFormDto;
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;

/**
 * VMS FORM Entity Class
 */
@Getter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("VMS FORM")
@Entity
@Table(name = "TB_VMS_FORM")
public class TbVmsFormSimple implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS FORM ID")  // N NUMBER(5)
    @Id
    @Column(name = "VMS_FORM_ID", nullable = false, columnDefinition = "NUMBER", length = 5)
    private Integer vmsFormId;

    @ApiModelProperty("VMS 유형 코드")  // Y VARCHAR(7)
    @Column(name = "VMS_TYPE_CD", length = 7)
    private String vmsTypeCd;

    @ApiModelProperty("VMS FORM 유형 코드")  // N NUMBER(3)
    @Column(name = "VMS_FORM_TYPE_CD", nullable = false, columnDefinition = "NUMBER", length = 3)
    private Integer vmsFormTypeCd;

    @ApiModelProperty("VMS 폼 배경 색상 코드")  // N NUMBER(3)
    @Column(name = "VMS_FORM_COLR_CD", nullable = false, columnDefinition = "NUMBER", length = 3)
    private Integer vmsFormColrCd;

    @ApiModelProperty("VMS FORM 명")  // Y VARCHAR(60)
    @Column(name = "VMS_FORM_NM", length = 60)
    private String vmsFormNm;

    @ApiModelProperty("VMS FORM 설명")  // Y VARCHAR(200)
    @Column(name = "VMS_FORM_EXPL", length = 200)
    private String vmsFormExpl;

    @ApiModelProperty("VMS 메시지 표출 방향 코드")  // Y NUMBER(3)
    @Column(name = "VMS_FORM_DSPL_DRCT_CD", columnDefinition = "NUMBER", length = 3)
    private Integer vmsFormDsplDrctCd;

    @ApiModelProperty("VMS 메시지 표출 방법 코드")  // Y NUMBER(3)
    @Column(name = "VMS_FORM_DSPL_MTHD_CD", columnDefinition = "NUMBER", length = 3)
    private Integer vmsFormDsplMthdCd;

    @ApiModelProperty("심벌라이브러리 번호")  // Y NUMBER(4)
    @Column(name = "SYMB_LIB_NMBR", columnDefinition = "NUMBER", length = 4)
    private Integer symbLibNmbr;

    @ApiModelProperty("갱신 일시")  // Y VARCHAR2(14)
    @Column(name = "UPDT_DT", length = 14)
    private String updtDt;

    @ApiModelProperty("폼유효여부")  // Y CHAR(1)
    @Column(name = "VALID_YN", columnDefinition = "CHAR", length = 1)
    private String validYn;

    public TbVmsFormDto toDto() {
        return TbVmsFormDto.builder()
                .vmsFormId(this.vmsFormId)
                .vmsTypeCd(this.vmsTypeCd)
                .vmsFormTypeCd(this.vmsFormTypeCd)
                .vmsFormColrCd(this.vmsFormColrCd)
                .vmsFormNm(this.vmsFormNm)
                .vmsFormExpl(this.vmsFormExpl)
                .vmsFormDsplDrctCd(this.vmsFormDsplDrctCd)
                .vmsFormDsplMthdCd(this.vmsFormDsplMthdCd)
                .symbLibNmbr(this.symbLibNmbr)
                .updtDt(this.updtDt)
                .validYn(this.validYn)
                .imagFmt("")
                .build();
    }

    public TbVmsFormSimple(Integer vmsFormId) {
        this.vmsFormId = vmsFormId;
    }

}
