package com.its.op.dto.its.vms;

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

    @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본)")  // N VARCHAR2(5)
    @JsonProperty("vms_sch_type")
    private String vmsSchType;

    @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상)")  // N NUMBER(3)
    @JsonProperty("vms_sch_form_type")
    private Integer vmsSchFormType;

    @ApiModelProperty("VMS FORM 표출 우선순위(낮을수록 우선순위가 높음)")  // Y NUMBER(2)
    @JsonProperty("vms_dspl_prrt")
    private Integer vmsDsplPrrt;

    // Code Description Field

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

        @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본), Nullable = N, VARCHAR2(5)")  // N VARCHAR2(5)
        @JsonProperty("vms_sch_type")
        @Size(min=1, max=5)
        private String vmsSchType;

        @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상), Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("vms_sch_form_type")
        @PositiveOrZero
        private Integer vmsSchFormType;

        @ApiModelProperty("VMS FORM 표출 우선순위(낮을수록 우선순위가 높음), Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("vms_dspl_prrt")
        @PositiveOrZero
        private Integer vmsDsplPrrt;

        @Builder
        public TbVmsDsplPrrtUpdReq(String vms_sch_type, Integer vms_sch_form_type, Integer vms_dspl_prrt) {
            this.vmsSchType = vms_sch_type;
            this.vmsSchFormType = vms_sch_form_type;
            this.vmsDsplPrrt = vms_dspl_prrt;
        }

        public TbVmsDsplPrrt toEntity() {
            return TbVmsDsplPrrt.builder()
                    .vmsSchType(this.vmsSchType)
                    .vmsSchFormType(this.vmsSchFormType)
                    .vmsDsplPrrt(this.vmsDsplPrrt)
                    .build();
        }

    }

}
