package com.oqpo.api.web.dto.response.pomng.pchOrd;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.oper.UserMngEntity;
import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.util.List;
import java.util.stream.Collectors;


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

    @ApiModelProperty(value = "브랜드아이디") private String brandId;
    @ApiModelProperty(value = "브랜드명") private String brandNm;
    @ApiModelProperty(value = "발주일자") private String podrDt;
    @ApiModelProperty(value = "발주담당자아이디") private String podrMgrId;
    @ApiModelProperty(value = "발주담당자명") private String podrMgrNm;
    @ApiModelProperty(value = "발주담당자연락처") private String podrMgrTelNo;
    @ApiModelProperty(value = "배송구분코드") private String dlvDvsn;
    @ApiModelProperty(value = "배송구분명") private String dlvDvsnNm;


    public static PoOrdInitInfoResponse toDTO(UserMngEntity uEntity, PchOdrBaseInfoEntity baseEntity ) {
        if (uEntity == null) return null;
        return PoOrdInitInfoResponse.builder()
                .brandId(baseEntity.getBrandId() == null ? "" : baseEntity.getBrandId())
                .brandNm(baseEntity.getBrandNm() == null ? "" : baseEntity.getBrandNm())
                .podrDt(baseEntity.getPodrDt() == null ? "" : baseEntity.getPodrDt())
                .podrMgrId(uEntity.getUserId() == null ? "" : uEntity.getUserId())
                .podrMgrNm(uEntity.getUserNm() == null ? "" : uEntity.getUserNm())
                .podrMgrTelNo(uEntity.getTelNo() == null ? "" : uEntity.getTelNo())
                .dlvDvsn(baseEntity.getDlvDvsn() == null ? "" : baseEntity.getDlvDvsn())
                .dlvDvsnNm(baseEntity.getDlvDvsnNm() == null ? "" : baseEntity.getDlvDvsnNm())
                .build();
    }


}
