package com.its.op.dto.its.rse;

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

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

/**
 * RSE 구간 링크구성 정보 DTO Class
 */
@Data
@Builder
@ApiModel("TbRseSectRltnLinkDto(RSE 구간 링크구성 정보)")
public class TbRseSectRltnLinkDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("RSE 구간 아이디")  // N NUMBER(10)
    @JsonProperty("rse_sect_id")
    private Long rseSectId;

    @ApiModelProperty("링크ID")  // N NUMBER(10)
    @JsonProperty("link_id")
    private Long linkId;

    @ApiModelProperty("링크 순서")  // Y NUMBER(2)
    @JsonProperty("link_ord")
    private Integer linkOrd;

    // Code Description Field
    @ApiModel("TbRseSectRltnLinkUpdReq(RSE 구간 링크구성 정보 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbRseSectRltnLinkUpdReq {

        @ApiModelProperty("RSE 구간 아이디, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("rse_sect_id")
        @PositiveOrZero
        private Long rseSectId;

        @ApiModelProperty("링크ID, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("link_id")
        @PositiveOrZero
        private Long linkId;

        @ApiModelProperty("링크 순서, Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("link_ord")
        @PositiveOrZero
        private Integer linkOrd;

        @Builder
        public TbRseSectRltnLinkUpdReq(Long rse_sect_id, Long link_id, Integer link_ord) {
            this.rseSectId = rse_sect_id;
            this.linkId = link_id;
            this.linkOrd = link_ord;
        }

        public TbRseSectRltnLink toEntity() {
            return TbRseSectRltnLink.builder()
                    .rseSectId(this.rseSectId)
                    .linkId(this.linkId)
                    .linkOrd(this.linkOrd)
                    .build();
        }

    }

}
