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

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

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

/**
 * RSE 구간 통과 이력 DTO Class
 */
@Data
@Builder
@ApiModel("TbRseSectPassHsDto(RSE 구간 통과 이력)")
public class TbRseSectPassHsDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("RSE 구간 아이디")  // N VARCHAR2(8)
    @JsonProperty("rse_sect_id")
    private String rseSectId;

    @ApiModelProperty("생성 일시")  // N VARCHAR2(14)
    @JsonProperty("crtn_dt")
    private String crtnDt;

    @ApiModelProperty("OBU 인식 번호")  // N VARCHAR2(200)
    @JsonProperty("obu_idnt_nmbr")
    private String obuIdntNmbr;

    @ApiModelProperty("시작 지점 통과 일시")  // N VARCHAR2(14)
    @JsonProperty("strt_spot_pass_dt")
    private String strtSpotPassDt;

    @ApiModelProperty("종료 지점 통과 일시")  // N VARCHAR2(14)
    @JsonProperty("end_spot_pass_dt")
    private String endSpotPassDt;

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

        @ApiModelProperty("RSE 구간 아이디, Nullable = N, VARCHAR2(8)")  // N VARCHAR2(8)
        @JsonProperty("rse_sect_id")
        @Size(min=1, max=8)
        private String rseSectId;

        @ApiModelProperty("생성 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("crtn_dt")
        @Size(min=1, max=14)
        private String crtnDt;

        @ApiModelProperty("OBU 인식 번호, Nullable = N, VARCHAR2(200)")  // N VARCHAR2(200)
        @JsonProperty("obu_idnt_nmbr")
        @Size(min=1, max=200)
        private String obuIdntNmbr;

        @ApiModelProperty("시작 지점 통과 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("strt_spot_pass_dt")
        @Size(min=1, max=14)
        private String strtSpotPassDt;

        @ApiModelProperty("종료 지점 통과 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("end_spot_pass_dt")
        @Size(min=1, max=14)
        private String endSpotPassDt;

        @Builder
        public TbRseSectPassHsUpdReq(String rse_sect_id, String crtn_dt, String obu_idnt_nmbr, String strt_spot_pass_dt, String end_spot_pass_dt) {
            this.rseSectId = rse_sect_id;
            this.crtnDt = crtn_dt;
            this.obuIdntNmbr = obu_idnt_nmbr;
            this.strtSpotPassDt = strt_spot_pass_dt;
            this.endSpotPassDt = end_spot_pass_dt;
        }

        public TbRseSectPassHs toEntity() {
            return TbRseSectPassHs.builder()
                    .rseSectId(this.rseSectId)
                    .crtnDt(this.crtnDt)
                    .obuIdntNmbr(this.obuIdntNmbr)
                    .strtSpotPassDt(this.strtSpotPassDt)
                    .endSpotPassDt(this.endSpotPassDt)
                    .build();
        }

    }

}
