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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
import com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.math.BigDecimal;

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

    @ApiModelProperty(value = "브랜드아이디")
    private String brandId;
    @ApiModelProperty(value = "창고아이디")
    private String whsId;
    @ApiModelProperty(value = "LOCATION")
    private String location;
    @ApiModelProperty(value = "품목아이디")
    private String itemId;
    @ApiModelProperty(value = "단위")
    private String unit;
    @ApiModelProperty(value = "재고수량")
    private Integer stckQty;
    @ApiModelProperty(value = "적정재고수량")
    private Integer prpStckQty;
    @ApiModelProperty(value = "안전재고비율")
    private BigDecimal sftStckRt;
    @ApiModelProperty(value = "현재고비율")
    private BigDecimal curStckRt;
    @ApiModelProperty(value = "시스템등록일시")
    private String sysRegDttm;
    @ApiModelProperty(value = "시스템등록아이디")
    private String sysRegId;
    @ApiModelProperty(value = "시스템변경일시")
    private String sysChgDttm;
    @ApiModelProperty(value = "시스템변경아이디")
    private String sysChgId;

    @ApiModelProperty(value = "브랜드명")
    private String brandNm;
    @ApiModelProperty(value = "창고명")
    private String whsNm;
    @ApiModelProperty(value = "LOCATION명")
    private String locationNm;
    @ApiModelProperty(value = "품목명")
    private String itemNm;

    @ApiModelProperty(value = "매장아이디")
    private String storeId;
    @ApiModelProperty(value = "매장명")
    private String storeNm;

    public static StockMngInfoResponse toDTO(StckMgntBaseInfoEntity entity) {
        if (entity == null) return null;
        return StockMngInfoResponse.builder()
                .brandId(entity.getBrandId())
                .brandNm(entity.getBrandNm())
                .whsId(entity.getWhsId())
                .whsNm(entity.getWhsNm())
                .location(entity.getLocation())
                .locationNm(entity.getLocationNm())
                .itemId(entity.getItemId())
                .itemNm(entity.getItemNm())
                .unit(entity.getUnit())
                .stckQty(entity.getStckQty())
                .prpStckQty(entity.getPrpStckQty())
                .sftStckRt(entity.getSftStckRt())
                .curStckRt(entity.getCurStckRt())
                .sysRegDttm(entity.getSysRegDttm())
                .sysRegId(entity.getSysRegId())
                .sysChgDttm(entity.getSysChgDttm())
                .sysChgId(entity.getSysChgId())
                .build();
    }

}
