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

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

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

/**
 * VMS FORM 배경색상 DTO Class
 */
@Data
@Builder
@ApiModel("TbVmsFormBckghueDto(VMS FORM 배경색상)")
public class TbVmsFormBckghueDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS FORM 배경 색상 코드")  // N NUMBER(10)
    @JsonProperty("vms_form_bckg_hue_cd")
    private Long vmsFormBckgHueCd;

    @ApiModelProperty("VMS FORM 배경 색상 명")  // Y VARCHAR(60)
    @JsonProperty("vms_form_bckg_hue_nm")
    private String vmsFormBckgHueNm;

    @ApiModelProperty("편집 코드")  // Y VARCHAR(7)
    @JsonProperty("edtn_cd")
    private String edtnCd;

    // Code Description Field
    @ApiModelProperty("VMS FORM 배경 색상 코드 설명")
    @JsonProperty("vms_form_bckg_hue_desc")    // VMS_FORM_BCKG_HUE_CD
    private Long vmsFormBckgHueDesc;

    @ApiModelProperty("편집 코드 설명")
    @JsonProperty("edtn_desc")    // EDTN_CD
    private String edtnDesc;

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

        @ApiModelProperty("VMS FORM 배경 색상 코드, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("vms_form_bckg_hue_cd")
        @PositiveOrZero
        private Long vmsFormBckgHueCd;

        @ApiModelProperty("VMS FORM 배경 색상 명, Nullable = Y, VARCHAR(60)")  // Y VARCHAR(60)
        @JsonProperty("vms_form_bckg_hue_nm")
        @Size(min=1, max=60)
        private String vmsFormBckgHueNm;

        @ApiModelProperty("편집 코드, Nullable = Y, VARCHAR(7)")  // Y VARCHAR(7)
        @JsonProperty("edtn_cd")
        @Size(min=1, max=7)
        private String edtnCd;

        @Builder
        public TbVmsFormBckghueUpdReq(Long vms_form_bckg_hue_cd, String vms_form_bckg_hue_nm, String edtn_cd) {
            this.vmsFormBckgHueCd = vms_form_bckg_hue_cd;
            this.vmsFormBckgHueNm = vms_form_bckg_hue_nm;
            this.edtnCd = edtn_cd;
        }

        public TbVmsFormBckghue toEntity() {
            return TbVmsFormBckghue.builder()
                    .vmsFormBckgHueCd(this.vmsFormBckgHueCd)
                    .vmsFormBckgHueNm(this.vmsFormBckgHueNm)
                    .edtnCd(this.edtnCd)
                    .build();
        }

    }

}
