package com.oqpo.api.web.dto.response.oper.salemgr;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.oper.PopEntity;
import com.oqpo.api.entity.oper.SaleMgrMgntEntity;
import com.oqpo.api.web.dto.response.oper.pop.PopResponse;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;


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

    @ApiModelProperty(value = "영업담당자아이디")
    private String saleMgrId;

    @ApiModelProperty(value = "영업담당자명")
    private String saleMgrNm;

    @ApiModelProperty(value = "상태코드")
    private String stCd;

    @ApiModelProperty(value = "상태명")
    private String stNm;

    @ApiModelProperty(value = "영업타입")
    private String saleType;

    @ApiModelProperty(value = "영업타입명")
    private String saleTypeNm;

    @ApiModelProperty(value = "전화번호")
    private String rprstTelNo;

    @ApiModelProperty(value = "FAX")
    private String rprstFaxNo;

    @ApiModelProperty(value = "이메일")
    private String rprstEmal;

    @ApiModelProperty(value = "우편번호")
    private String zipNo;

    @ApiModelProperty(value = "주소1")
    private String addr1;

    @ApiModelProperty(value = "주소2")
    private String addr2;

    @ApiModelProperty(value = "x좌표")
    private String latX;

    @ApiModelProperty(value = "Y좌표")
    private String longY;

    @ApiModelProperty(value = "등록자")
    private String regId;

    @ApiModelProperty(value = "등록일")
    private String regDt;

    @ApiModelProperty(value = "시스템등록일")
    private String sysRegDttm;

    @ApiModelProperty(value = "시스템등록자")
    private String sysRegId;

    @ApiModelProperty(value = "시스템변경일")
    private String sysChgDttm;

    @ApiModelProperty(value = "시스템변경자")
    private String sysChgId;

    public static SaleMgrMgnInfoResponse toDTO(SaleMgrMgntEntity entity) {
        if (entity == null) return null;
        return SaleMgrMgnInfoResponse.builder()
                .saleMgrId(entity.getSaleMgrId())
                .saleMgrNm(entity.getSaleMgrNm())
                .stCd(entity.getStCd())
                .stNm(entity.getStNm())
                .saleType(entity.getSaleType() == null ? "" :entity.getSaleType() )
                .saleTypeNm(entity.getSaleTypeNm() == null ? "" :entity.getSaleTypeNm() )
                .rprstTelNo(entity.getRprstTelNo() == null ? "" : entity.getRprstTelNo())
                .rprstFaxNo(entity.getRprstFaxNo() == null ? "" : entity.getRprstFaxNo())
                .rprstEmal(entity.getRprstEmai() == null ? "" : entity.getRprstEmai())
                .zipNo(entity.getZipNo() == null ? "" : entity.getZipNo())
                .addr1(entity.getAddr1() == null ? "" : entity.getAddr1())
                .addr2(entity.getAddr2() == null ? "" : entity.getAddr2())
                .latX(entity.getLatX() == null ? "" : entity.getLatX())
                .longY(entity.getLongY() == null ? "" : entity.getLongY())
                .regId(entity.getRegId() == null ? "" : entity.getRegId())
                .regDt(entity.getRegDt() == null ? "" : entity.getRegDt())
                .sysRegDttm(entity.getSysRegDttm())
                .sysRegId(entity.getRegId())
                .sysChgDttm(entity.getSysChgDttm())
                .sysChgId(entity.getSysChgId())
                .build();
    }
}
