package com.its.api.its.model.dto.vms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.api.its.model.entity.vms.TbVmsFormObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.PositiveOrZero;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * VMS FORM OBJECT DTO Class
 */
@Data
@Builder
@ApiModel("TbVmsFormObjectDto(VMS FORM OBJECT)")
public class TbVmsFormObjectDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("FORM OBJECT ID")  // N NUMBER(5)
    @JsonProperty("form_object_id")
    private Integer formObjectId;

    @ApiModelProperty("VMS FORM ID")  // N NUMBER(5)
    @JsonProperty("vms_form_id")
    private Integer vmsFormId;

    @ApiModelProperty("VMS FORM 표출 행")  // Y NUMBER(2)
    @JsonProperty("vms_form_dspl_row")
    private Integer vmsFormDsplRow;

    @ApiModelProperty("VMS FORM 표출 칼럼")  // Y NUMBER(2)
    @JsonProperty("vms_form_dspl_clmn")
    private Integer vmsFormDsplClmn;

    @ApiModelProperty("VMS FORM OBJECT 유형 코드")  // N NUMBER(3)
    @JsonProperty("vms_form_object_type_cd")
    private Integer vmsFormObjectTypeCd;

    @ApiModelProperty("VMS 글꼴 유형 코드")  // N NUMBER(3)
    @JsonProperty("vms_font_type_cd")
    private Integer vmsFontTypeCd;

    @ApiModelProperty("VMS 글꼴 색상 코드")  // N NUMBER(9)
    @JsonProperty("vms_font_hue_cd")
    private Integer vmsFontHueCd;

    @ApiModelProperty("VMS 글꼴 방식 코드")  // Y NUMBER(3)
    @JsonProperty("vms_font_styl_cd")
    private Integer vmsFontStylCd;

    @ApiModelProperty("VMS 글꼴 크기")  // Y NUMBER(3)
    @JsonProperty("vms_font_size")
    private Integer vmsFontSize;

    @ApiModelProperty("VMS 표출 문자열정열방식(0:LEFT,1:RIGHT,2:CENTER)")  // Y NUMBER(1)
    @JsonProperty("vms_font_align")
    private Integer vmsFontAlign;

    @ApiModelProperty("VMS 표출 텍스트")  // Y VARCHAR(200)
    @JsonProperty("vms_dspl_txt")
    private String vmsDsplTxt;

    @ApiModelProperty("VMS 표출 도형")  // Y BLOB
    @JsonProperty("vms_dspl_figr")
    private byte[] vmsDsplFigr;

    @ApiModelProperty("VMS 표출 X좌표")  // Y NUMBER(5)
    @JsonProperty("vms_dspl_xcrdn")
    private Integer vmsDsplXcrdn;

    @ApiModelProperty("VMS 표출 Y좌표")  // Y NUMBER(5)
    @JsonProperty("vms_dspl_ycrdn")
    private Integer vmsDsplYcrdn;

    @ApiModelProperty("VMS 표출 넓이")  // Y NUMBER(5)
    @JsonProperty("vms_dspl_width")
    private Integer vmsDsplWidth;

    @ApiModelProperty("VMS 표출 높이")  // Y NUMBER(5)
    @JsonProperty("vms_dspl_height")
    private Integer vmsDsplHeight;

    @ApiModelProperty("VMS 표출 점멸 여부(0:지속, 1:점멸)")  // Y NUMBER(1)
    @JsonProperty("vms_dspl_blinking")
    private Integer vmsDsplBlinking;

    @ApiModelProperty("VMS 표출 배경색상코드")  // Y NUMBER(1)
    @JsonProperty("vms_dspl_bkcolor")
    private Integer vmsDsplBkcolor;

    @ApiModelProperty("VMS 표출 크기(문자:문자길이,이미지:이미지전체크기)")  // Y NUMBER(7)
    @JsonProperty("vms_dspl_size")
    private Integer vmsDsplSize;

    @ApiModelProperty("FILL-IN 메시지 여부")  // Y CHAR(1)
    @JsonProperty("trfc_fill_cd")
    private String trfcFillCd;

    @ApiModelProperty("심벌라이브러리 번호")  // Y NUMBER(4)
    @JsonProperty("symb_lib_nmbr")
    private Integer symbLibNmbr;

    @ApiModelProperty("VMS 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("vms_ifsc_id")
    private Long vmsIfscId;

    // Code Description Field
    @ApiModelProperty("VMS FORM OBJECT 유형 코드 설명")
    @JsonProperty("vms_form_object_type_desc")    // VMS_FORM_OBJECT_TYPE_CD
    private Integer vmsFormObjectTypeDesc;

    @ApiModelProperty("VMS 글꼴 유형 코드 설명")
    @JsonProperty("vms_font_type_desc")    // VMS_FONT_TYPE_CD
    private Integer vmsFontTypeDesc;

    @ApiModelProperty("VMS 글꼴 색상 코드 설명")
    @JsonProperty("vms_font_hue_desc")    // VMS_FONT_HUE_CD
    private Integer vmsFontHueDesc;

    @ApiModelProperty("VMS 글꼴 방식 코드 설명")
    @JsonProperty("vms_font_styl_desc")    // VMS_FONT_STYL_CD
    private Integer vmsFontStylDesc;

    @ApiModelProperty("FILL-IN 메시지 여부 설명")
    @JsonProperty("trfc_fill_desc")    // TRFC_FILL_CD
    private String trfcFillDesc;

    @ApiModel("TbVmsFormObjectUpdReq(VMS FORM OBJECT 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbVmsFormObjectUpdReq {

        @ApiModelProperty("FORM OBJECT ID, Nullable = N, NUMBER(5)")  // N NUMBER(5)
        @JsonProperty("form_object_id")
        @PositiveOrZero
        private Integer formObjectId;

        @ApiModelProperty("VMS FORM ID, Nullable = N, NUMBER(5)")  // N NUMBER(5)
        @JsonProperty("vms_form_id")
        @PositiveOrZero
        private Integer vmsFormId;

        @ApiModelProperty("VMS FORM 표출 행, Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("vms_form_dspl_row")
        @PositiveOrZero
        private Integer vmsFormDsplRow;

        @ApiModelProperty("VMS FORM 표출 칼럼, Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("vms_form_dspl_clmn")
        @PositiveOrZero
        private Integer vmsFormDsplClmn;

        @ApiModelProperty("VMS FORM OBJECT 유형 코드, Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("vms_form_object_type_cd")
        @PositiveOrZero
        private Integer vmsFormObjectTypeCd;

        @ApiModelProperty("VMS 글꼴 유형 코드, Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("vms_font_type_cd")
        @PositiveOrZero
        private Integer vmsFontTypeCd;

        @ApiModelProperty("VMS 글꼴 색상 코드, Nullable = N, NUMBER(9)")  // N NUMBER(9)
        @JsonProperty("vms_font_hue_cd")
        @PositiveOrZero
        private Integer vmsFontHueCd;

        @ApiModelProperty("VMS 글꼴 방식 코드, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("vms_font_styl_cd")
        @PositiveOrZero
        private Integer vmsFontStylCd;

        @ApiModelProperty("VMS 글꼴 크기, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("vms_font_size")
        @PositiveOrZero
        private Integer vmsFontSize;

        @ApiModelProperty("VMS 표출 문자열정열방식(0:LEFT,1:RIGHT,2:CENTER), Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("vms_font_align")
        @PositiveOrZero
        private Integer vmsFontAlign;

        @ApiModelProperty("VMS 표출 텍스트, Nullable = Y, VARCHAR(200)")  // Y VARCHAR(200)
        @JsonProperty("vms_dspl_txt")
        @Size(min=1, max=200)
        private String vmsDsplTxt;

        @ApiModelProperty("VMS 표출 도형, Nullable = Y, Image Data")  // Y BLOB
        @JsonProperty("vms_dspl_figr")
        private byte[] vmsDsplFigr;

        @ApiModelProperty("VMS 표출 X좌표, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_dspl_xcrdn")
        @PositiveOrZero
        private Integer vmsDsplXcrdn;

        @ApiModelProperty("VMS 표출 Y좌표, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_dspl_ycrdn")
        @PositiveOrZero
        private Integer vmsDsplYcrdn;

        @ApiModelProperty("VMS 표출 넓이, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_dspl_width")
        @PositiveOrZero
        private Integer vmsDsplWidth;

        @ApiModelProperty("VMS 표출 높이, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_dspl_height")
        @PositiveOrZero
        private Integer vmsDsplHeight;

        @ApiModelProperty("VMS 표출 점멸 여부(0:지속, 1:점멸), Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("vms_dspl_blinking")
        @PositiveOrZero
        private Integer vmsDsplBlinking;

        @ApiModelProperty("VMS 표출 배경색상코드, Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("vms_dspl_bkcolor")
        @PositiveOrZero
        private Integer vmsDsplBkcolor;

        @ApiModelProperty("VMS 표출 크기(문자:문자길이,이미지:이미지전체크기), Nullable = Y, NUMBER(7)")  // Y NUMBER(7)
        @JsonProperty("vms_dspl_size")
        @PositiveOrZero
        private Integer vmsDsplSize;

        @ApiModelProperty("FILL-IN 메시지 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("trfc_fill_cd")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String trfcFillCd;

        @ApiModelProperty("심벌라이브러리 번호, Nullable = Y, NUMBER(4)")  // Y NUMBER(4)
        @JsonProperty("symb_lib_nmbr")
        @PositiveOrZero
        private Integer symbLibNmbr;

        @ApiModelProperty("VMS 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("vms_ifsc_id")
        @PositiveOrZero
        private Long vmsIfscId;

        @Builder
        public TbVmsFormObjectUpdReq(Integer form_object_id, Integer vms_form_id, Integer vms_form_dspl_row, Integer vms_form_dspl_clmn, Integer vms_form_object_type_cd, Integer vms_font_type_cd, Integer vms_font_hue_cd, Integer vms_font_styl_cd, Integer vms_font_size, Integer vms_font_align, String vms_dspl_txt, byte[] vms_dspl_figr, Integer vms_dspl_xcrdn, Integer vms_dspl_ycrdn, Integer vms_dspl_width, Integer vms_dspl_height, Integer vms_dspl_blinking, Integer vms_dspl_bkcolor, Integer vms_dspl_size, String trfc_fill_cd, Integer symb_lib_nmbr, Long vms_ifsc_id) {
            this.formObjectId = form_object_id;
            this.vmsFormId = vms_form_id;
            this.vmsFormDsplRow = vms_form_dspl_row;
            this.vmsFormDsplClmn = vms_form_dspl_clmn;
            this.vmsFormObjectTypeCd = vms_form_object_type_cd;
            this.vmsFontTypeCd = vms_font_type_cd;
            this.vmsFontHueCd = vms_font_hue_cd;
            this.vmsFontStylCd = vms_font_styl_cd;
            this.vmsFontSize = vms_font_size;
            this.vmsFontAlign = vms_font_align;
            this.vmsDsplTxt = vms_dspl_txt;
            this.vmsDsplFigr = vms_dspl_figr;
            this.vmsDsplXcrdn = vms_dspl_xcrdn;
            this.vmsDsplYcrdn = vms_dspl_ycrdn;
            this.vmsDsplWidth = vms_dspl_width;
            this.vmsDsplHeight = vms_dspl_height;
            this.vmsDsplBlinking = vms_dspl_blinking;
            this.vmsDsplBkcolor = vms_dspl_bkcolor;
            this.vmsDsplSize = vms_dspl_size;
            this.trfcFillCd = trfc_fill_cd;
            this.symbLibNmbr = symb_lib_nmbr;
            this.vmsIfscId = vms_ifsc_id;
        }

        public TbVmsFormObject toEntity() {
            return TbVmsFormObject.builder()
                    .formObjectId(this.formObjectId)
                    .vmsFormId(this.vmsFormId)
                    .vmsFormDsplRow(this.vmsFormDsplRow)
                    .vmsFormDsplClmn(this.vmsFormDsplClmn)
                    .vmsFormObjectTypeCd(this.vmsFormObjectTypeCd)
                    .vmsFontTypeCd(this.vmsFontTypeCd)
                    .vmsFontHueCd(this.vmsFontHueCd)
                    .vmsFontStylCd(this.vmsFontStylCd)
                    .vmsFontSize(this.vmsFontSize)
                    .vmsFontAlign(this.vmsFontAlign)
                    .vmsDsplTxt(this.vmsDsplTxt)
                    .vmsDsplFigr(this.vmsDsplFigr)
                    .vmsDsplXcrdn(this.vmsDsplXcrdn)
                    .vmsDsplYcrdn(this.vmsDsplYcrdn)
                    .vmsDsplWidth(this.vmsDsplWidth)
                    .vmsDsplHeight(this.vmsDsplHeight)
                    .vmsDsplBlinking(this.vmsDsplBlinking)
                    .vmsDsplBkcolor(this.vmsDsplBkcolor)
                    .vmsDsplSize(this.vmsDsplSize)
                    .trfcFillCd(this.trfcFillCd)
                    .symbLibNmbr(this.symbLibNmbr)
                    .vmsIfscId(this.vmsIfscId)
                    .build();
        }

    }

}
