package com.oqpo.api.web.dto.response.numb;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.system.NumbEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

@Getter
@Setter
@Builder
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@JsonInclude(JsonInclude.Include.ALWAYS)
public class NumbResponse {

    @ApiModelProperty(value = "채번번호")
    private Integer numNo;

    @ApiModelProperty(value = "정의어")
    private String defiInfo;

    @ApiModelProperty(value = "채번명")
    private String numNm;

    @ApiModelProperty(value = "년 여부")
    private String yearChk;

    @ApiModelProperty(value = "월 여부")
    private String monthChk;

    @ApiModelProperty(value = "일 여부")
    private String dayChk;

    @ApiModelProperty(value = "시작번호")
    private Integer numStNo;

    @ApiModelProperty(value = "종료번호")
    private Integer numEdNo;

    @ApiModelProperty(value = "현사용번호")
    private Integer numUseNo;

    @ApiModelProperty(value = "현채번번호")
    private String numCuNo;

    @ApiModelProperty(value = "사용여부")
    private String useYn;

    @ApiModelProperty(value = "발급일")
    private String useDay;

    @ApiModelProperty(value = "사용여부명")
    private String useYnNm;

    public static NumbResponse toDTO(NumbEntity entity) {
        if (entity == null) return null;
        return NumbResponse.builder()
                .numNo(entity.getNumNo())
                .defiInfo(entity.getDefiInfo())
                .numNm(entity.getNumNm())
                .yearChk(entity.getYearChk())
                .monthChk(entity.getMonthChk())
                .dayChk(entity.getDayChk())
                .numStNo(entity.getNumStNo())
                .numEdNo(entity.getNumEdNo())
                .numUseNo(entity.getNumUseNo())
                .numCuNo(entity.getNumCuNo())
                .useYn(entity.getUseYn())
                .useDay(entity.getUseDay())
                .build();
    }
}
