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

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


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

    @ApiModelProperty(value = "정산관리고유번호")
    private String sttlMgntUnqNo;
    @ApiModelProperty(value = "브랜드아이디")
    private String brandId;
    @ApiModelProperty(value = "브랜드명")
    private String brandNm;
    @ApiModelProperty(value = "매장아이디")
    private String storeId;
    @ApiModelProperty(value = "매장명")
    private String storeNm;
    @ApiModelProperty(value = "공급사아이디")
    private String spplyId;
    @ApiModelProperty(value = "공급사명")
    private String spplyNm;
    @ApiModelProperty(value = "정산상태코드")
    private String sttlStCd;
    @ApiModelProperty(value = "정산상태명")
    private String sttlStNm;

    @ApiModelProperty(value = "정산요청일자")
    private String sttlReqDt;
    @ApiModelProperty(value = "정산확정일자")
    private String sttlDt;

    @ApiModelProperty(value = "정산요청금액")
    private Long sttlReqAmt;
    @ApiModelProperty(value = "정산확정금액")
    private Long sttlAmt;
    @ApiModelProperty(value = "수납금액")
    private Long rcptAmt;
    @ApiModelProperty(value = "미납금액")
    private Long unpaidAmt;

    @ApiModelProperty(value = "정산등록담당자명")
    private String sttlRegMgrNm;
    @ApiModelProperty(value = "정산등록담당자아이디")
    private String sttlRegMgrId;

    @ApiModelProperty(value = "시스템등록일시")
    private String sysRegDttm;
    @ApiModelProperty(value = "시스템등록아이디")
    private String sysRegId;
    @ApiModelProperty(value = "시스템등록자")
    private String sysRegNm;
    @ApiModelProperty(value = "시스템변경일시")
    private String sysChgDttm;
    @ApiModelProperty(value = "시스템변경아이디")
    private String sysChgId;
    @ApiModelProperty(value = "정산반려사유")
    private String sttlRjctRsn;

    @ApiModelProperty(value = "수납여부(후불사용)")
    private String rcptYn;
    @ApiModelProperty(value = "수납일자(후불사용)")
    private String rcptDt;

    @ApiModelProperty(value = "매장 계좌잔액")
    private Long acctBal;
    @ApiModelProperty(value = "여신구분")
    private String loanDvsn;
    @ApiModelProperty(value = "여신구분명")
    private String loanDvsnNm;

    public static SttlMngInfoResponse toDTO(StlMgntBaseInfoEntity entity) {
        if (entity == null) return null;
        return SttlMngInfoResponse.builder()
                .sttlMgntUnqNo(entity.getSttlMgntUnqNo())
                .brandId(entity.getBrandId())
                .brandNm(entity.getBrandNm())
                .storeId(entity.getStoreId())
                .storeNm(entity.getStoreNm())
                .spplyId(entity.getSpplyId())
                .spplyNm(entity.getSpplyNm())
                .sttlStCd(entity.getSttlStCd())
                .sttlStNm(entity.getSttlStNm())
                .sttlRjctRsn(entity.getSttlRjctRsn())
                .sttlReqDt(entity.getSttlReqDt())
                .sttlDt(entity.getSttlDt())
                .sttlReqAmt(entity.getSttlReqAmt())
                .sttlAmt(entity.getSttlAmt())
                .rcptAmt(entity.getRcptAmt())
                .unpaidAmt(entity.getUnpaidAmt())
                .acctBal(entity.getAcctBal())               /* 매장 계좌잔액 */
                .loanDvsn(entity.getLoanDvsn())             /* 매장 여신구분 */
                .loanDvsnNm(entity.getLoanDvsnNm())
                .sttlRegMgrNm(entity.getSttlRegMgrNm())
                .sttlRegMgrId(entity.getSttlRegMgrId())
                .sysRegDttm(entity.getSysRegDttm())
                .sysRegId(entity.getSysRegId())
                .sysRegNm(entity.getSysRegNm())
                .sysChgDttm(entity.getSysChgDttm())
                .sysChgId(entity.getSysChgId())
                .rcptYn(entity.getRcptYn())
                .rcptDt(entity.getRcptDt())
                .build();
    }

}
