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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.vms.TbVmsSymbIfsc;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.PositiveOrZero;
import java.io.Serializable;

/**
 * VMS 심벌 라이브러리 셀 구간정보 DTO Class
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("TbVmsSymbIfscDto(VMS 심벌 라이브러리 셀 구간정보)")
public class TbVmsSymbIfscDto implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty("셀 ID")  // N NUMBER(4)
    @JsonProperty("cell_id")
    private Integer cellId;

    @ApiModelProperty("이미지내 셀좌표 X")  // Y NUMBER(4)
    @JsonProperty("posx")
    private Integer posx;

    @ApiModelProperty("이미지내 셀좌표 Y")  // Y NUMBER(4)
    @JsonProperty("posy")
    private Integer posy;

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

    @ApiModelProperty("표출 시작 노드 명")  // Y VARCHAR(30)
    @JsonProperty("dspl_strt_node_nm")
    private String dsplStrtNodeNm;

    @ApiModelProperty("표출 종료 노드 명")  // Y VARCHAR(30)
    @JsonProperty("dspl_end_node_nm")
    private String dsplEndNodeNm;

    // Code Description Field
    @ApiModel("TbVmsSymbIfscUpdReq(VMS 심벌 라이브러리 셀 구간정보 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbVmsSymbIfscUpdReq {

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

        @ApiModelProperty("셀 ID, Nullable = N, NUMBER(4)")  // N NUMBER(4)
        @JsonProperty("cell_id")
        @PositiveOrZero
        private Integer cellId;

        @ApiModelProperty("이미지내 셀좌표 X, Nullable = Y, NUMBER(4)")  // Y NUMBER(4)
        @JsonProperty("posx")
        //@PositiveOrZero
        @Min(value = 0)
        @Max(value = 9999)
        private Integer posx;

        @ApiModelProperty("이미지내 셀좌표 Y, Nullable = Y, NUMBER(4)")  // Y NUMBER(4)
        @JsonProperty("posy")
        //@PositiveOrZero
        @Min(value = 0)
        @Max(value = 9999)
        private Integer posy;

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

        @Builder
        public TbVmsSymbIfscUpdReq(Integer symblib_nmbr, Integer cell_id, Integer posx, Integer posy, Long vms_ifsc_id) {
            this.symbLibNmbr = symblib_nmbr;
            this.cellId = cell_id;
            this.posx = posx;
            this.posy = posy;
            this.vmsIfscId = vms_ifsc_id;
        }


        public TbVmsSymbIfsc toEntity() {
            return TbVmsSymbIfsc.builder()
                    .symbLibNmbr(this.symbLibNmbr)
                    .cellId(this.cellId)
                    .posx(this.posx)
                    .posy(this.posy)
                    .vmsIfscId(this.vmsIfscId)
                    .build();
        }

    }

}
