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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.rse.TbRseOffrSectTrafHs;
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;

/**
 * RSE 제공구간 정보제공 이력 DTO Class
 */
@Data
@Builder
@ApiModel("TbRseOffrSectTrafHsDto(RSE 제공구간 정보제공 이력)")
public class TbRseOffrSectTrafHsDto implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty("제공 일시")  // N VARCHAR2(14)
    @JsonProperty("prcn_dt")
    private String prcnDt;

    @ApiModelProperty("제공 내용")  // Y VARCHAR2(100)
    @JsonProperty("offr_cont")
    private String offrCont;

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

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

        @ApiModelProperty("제공 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("prcn_dt")
        @Size(min=1, max=14)
        private String prcnDt;

        @ApiModelProperty("제공 내용, Nullable = Y, VARCHAR2(100)")  // Y VARCHAR2(100)
        @JsonProperty("offr_cont")
        @Size(min=1, max=100)
        private String offrCont;

        @Builder
        public TbRseOffrSectTrafHsUpdReq(Long offr_sect_id, String prcn_dt, String offr_cont) {
            this.offrSectId = offr_sect_id;
            this.prcnDt = prcn_dt;
            this.offrCont = offr_cont;
        }

        public TbRseOffrSectTrafHs toEntity() {
            return TbRseOffrSectTrafHs.builder()
                    .offrSectId(this.offrSectId)
                    .prcnDt(this.prcnDt)
                    .offrCont(this.offrCont)
                    .build();
        }

    }

}
