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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.rse.TbRseOffrSectRltnIfsc;
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("TbRseOffrSectRltnIfscDto(RSE 제공 구간 정보)")
public class TbRseOffrSectRltnIfscDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("제공 구간 아이디")  // N NUMBER(10)
    @JsonProperty("offr_sect_id")
    private Long offrSectId;

    @ApiModelProperty("정보제공구간 ID")  // N NUMBER(10)
    @JsonProperty("ifsc_id")
    private Long ifscId;

    @ApiModelProperty("순서")  // Y NUMBER(3)
    @JsonProperty("ord")
    private Integer ord;

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

        @ApiModelProperty("제공 구간 아이디, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("offr_sect_id")
        @PositiveOrZero
        private Long offrSectId;

        @ApiModelProperty("정보제공구간 ID, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("ifsc_id")
        @PositiveOrZero
        private Long ifscId;

        @ApiModelProperty("순서, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("ord")
        @PositiveOrZero
        private Integer ord;

        @Builder
        public TbRseOffrSectRltnIfscUpdReq(Long offr_sect_id, Long ifsc_id, Integer ord) {
            this.offrSectId = offr_sect_id;
            this.ifscId = ifsc_id;
            this.ord = ord;
        }

        public TbRseOffrSectRltnIfsc toEntity() {
            return TbRseOffrSectRltnIfsc.builder()
                    .offrSectId(this.offrSectId)
                    .ifscId(this.ifscId)
                    .ord(this.ord)
                    .build();
        }

    }

}
