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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.api.its.model.entity.vms.TbVmsFormPrrt;
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("TbVmsFormPrrtDto(VMS FORM 우선순위)")
public class TbVmsFormPrrtDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS FORM 우선순위 코드")  // N VARCHAR(3)
    @JsonProperty("vms_form_prrt_cd")
    private String vmsFormPrrtCd;

    @ApiModelProperty("VMS FORM 우선순위")  // Y NUMBER(2)
    @JsonProperty("vms_form_prrt")
    private Integer vmsFormPrrt;

    @ApiModelProperty("VMS FORM 유형 코드")  // Y NUMBER(3)
    @JsonProperty("vms_form_type_cd")
    private Integer vmsFormTypeCd;

    @ApiModelProperty("VMS 용도 유형 코드")  // Y VARCHAR(7)
    @JsonProperty("vms_usag_type_cd")
    private String vmsUsagTypeCd;

    // Code Description Field
    @ApiModelProperty("VMS FORM 우선순위 코드 설명")
    @JsonProperty("vms_form_prrt_desc")    // VMS_FORM_PRRT_CD
    private String vmsFormPrrtDesc;

    @ApiModelProperty("VMS FORM 유형 코드 설명")
    @JsonProperty("vms_form_type_desc")    // VMS_FORM_TYPE_CD
    private Integer vmsFormTypeDesc;

    @ApiModelProperty("VMS 용도 유형 코드 설명")
    @JsonProperty("vms_usag_type_desc")    // VMS_USAG_TYPE_CD
    private String vmsUsagTypeDesc;

    @ApiModel("TbVmsFormPrrtUpdReq(VMS FORM 우선순위 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbVmsFormPrrtUpdReq {

        @ApiModelProperty("VMS FORM 우선순위 코드, Nullable = N, VARCHAR(3)")  // N VARCHAR(3)
        @JsonProperty("vms_form_prrt_cd")
        @Size(min=1, max=3)
        private String vmsFormPrrtCd;

        @ApiModelProperty("VMS FORM 우선순위, Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("vms_form_prrt")
        @PositiveOrZero
        private Integer vmsFormPrrt;

        @ApiModelProperty("VMS FORM 유형 코드, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("vms_form_type_cd")
        @PositiveOrZero
        private Integer vmsFormTypeCd;

        @ApiModelProperty("VMS 용도 유형 코드, Nullable = Y, VARCHAR(7)")  // Y VARCHAR(7)
        @JsonProperty("vms_usag_type_cd")
        @Size(min=1, max=7)
        private String vmsUsagTypeCd;

        @Builder
        public TbVmsFormPrrtUpdReq(String vms_form_prrt_cd, Integer vms_form_prrt, Integer vms_form_type_cd, String vms_usag_type_cd) {
            this.vmsFormPrrtCd = vms_form_prrt_cd;
            this.vmsFormPrrt = vms_form_prrt;
            this.vmsFormTypeCd = vms_form_type_cd;
            this.vmsUsagTypeCd = vms_usag_type_cd;
        }

        public TbVmsFormPrrt toEntity() {
            return TbVmsFormPrrt.builder()
                    .vmsFormPrrtCd(this.vmsFormPrrtCd)
                    .vmsFormPrrt(this.vmsFormPrrt)
                    .vmsFormTypeCd(this.vmsFormTypeCd)
                    .vmsUsagTypeCd(this.vmsUsagTypeCd)
                    .build();
        }

    }

}
