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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.rse.TbRseObuClctPnst;
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 OBU 수집 이력 DTO Class
 */
@Data
@Builder
@ApiModel("TbRseObuClctPnstDto(RSE OBU 수집 이력)")
public class TbRseObuClctPnstDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("RSE 제어기 번호")  // N NUMBER(10)
    @JsonProperty("rse_ctlr_nmbr")
    private Long rseCtlrNmbr;

    @ApiModelProperty("수집 일시")  // N VARCHAR2(14)
    @JsonProperty("clct_dt")
    private String clctDt;

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

    @ApiModelProperty("차종")  // Y VARCHAR2(7)
    @JsonProperty("ctyp")
    private String ctyp;

    @ApiModelProperty("OBU 종류")  // Y VARCHAR2(7)
    @JsonProperty("obu_kind")
    private String obuKind;

    // Code Description Field
    @ApiModel("TbRseObuClctPnstUpdReq(RSE OBU 수집 이력 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbRseObuClctPnstUpdReq {

        @ApiModelProperty("RSE 제어기 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("rse_ctlr_nmbr")
        @PositiveOrZero
        private Long rseCtlrNmbr;

        @ApiModelProperty("수집 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("clct_dt")
        @Size(min=1, max=14)
        private String clctDt;

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

        @ApiModelProperty("차종, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("ctyp")
        @Size(min=1, max=7)
        private String ctyp;

        @ApiModelProperty("OBU 종류, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("obu_kind")
        @Size(min=1, max=7)
        private String obuKind;

        @Builder
        public TbRseObuClctPnstUpdReq(Long rse_ctlr_nmbr, String clct_dt, String obu_idnt_nmbr, String ctyp, String obu_kind) {
            this.rseCtlrNmbr = rse_ctlr_nmbr;
            this.clctDt = clct_dt;
            this.obuIdntNmbr = obu_idnt_nmbr;
            this.ctyp = ctyp;
            this.obuKind = obu_kind;
        }

        public TbRseObuClctPnst toEntity() {
            return TbRseObuClctPnst.builder()
                    .rseCtlrNmbr(this.rseCtlrNmbr)
                    .clctDt(this.clctDt)
                    .obuIdntNmbr(this.obuIdntNmbr)
                    .ctyp(this.ctyp)
                    .obuKind(this.obuKind)
                    .build();
        }

    }

}
