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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.rse.TbRseObuClctStatDd;
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("TbRseObuClctStatDdDto(RSE OBU 수집 일 통계)")
public class TbRseObuClctStatDdDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("통계 일시")  // N VARCHAR2(14)
    @JsonProperty("stat_dt")
    private String statDt;

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

    @ApiModelProperty("요일 유형 코드")  // Y VARCHAR2(7)
    @JsonProperty("day_type_cd")
    private String dayTypeCd;

    @ApiModelProperty("수집 개수")  // Y NUMBER(7)
    @JsonProperty("clct_num")
    private Integer clctNum;

    // Code Description Field
    @ApiModelProperty("요일 유형 코드 설명")
    @JsonProperty("day_type_desc")    // DAY_TYPE_CD
    private String dayTypeDesc;

    @ApiModel("TbRseObuClctStatDdUpdReq(RSE OBU 수집 일 통계 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbRseObuClctStatDdUpdReq {

        @ApiModelProperty("통계 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("stat_dt")
        @Size(min=1, max=14)
        private String statDt;

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

        @ApiModelProperty("요일 유형 코드, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("day_type_cd")
        @Size(min=1, max=7)
        private String dayTypeCd;

        @ApiModelProperty("수집 개수, Nullable = Y, NUMBER(7)")  // Y NUMBER(7)
        @JsonProperty("clct_num")
        @PositiveOrZero
        private Integer clctNum;

        @Builder
        public TbRseObuClctStatDdUpdReq(String stat_dt, Long rse_ctlr_nmbr, String day_type_cd, Integer clct_num) {
            this.statDt = stat_dt;
            this.rseCtlrNmbr = rse_ctlr_nmbr;
            this.dayTypeCd = day_type_cd;
            this.clctNum = clct_num;
        }

        public TbRseObuClctStatDd toEntity() {
            return TbRseObuClctStatDd.builder()
                    .statDt(this.statDt)
                    .rseCtlrNmbr(this.rseCtlrNmbr)
                    .dayTypeCd(this.dayTypeCd)
                    .clctNum(this.clctNum)
                    .build();
        }

    }

}
