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

import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class PchReqOrdPassQtyRequest {

    @ApiModelProperty(value = "브랜드아이디")
    private String brandId;

    @ApiModelProperty(value = "창고아이디")
    private String whsId;

    @ApiModelProperty(value = "LOCATION")
    private String location;

    @ApiModelProperty(value = "출고가능 품목수량 리스트")
    private List<PchReqOrdPassQtyRequest.StockPassItemData> gridUpdateData;


    public List<StckMgntBaseInfoEntity> toCodeEntities(List< PchReqOrdPassQtyRequest.StockPassItemData > gridData) {
        List<StckMgntBaseInfoEntity> entities = new ArrayList<>();
        if (gridData == null || gridData.size() == 0)
            return entities;

        gridData.forEach(x -> {
            StckMgntBaseInfoEntity entity = new StckMgntBaseInfoEntity();
            entity.setItemId(x.getItemId());
            entities.add(entity);
        });
        return entities;
    }

    @Getter
    @Builder
    @AllArgsConstructor(access = AccessLevel.PROTECTED)
    static class StockPassItemData {

        @ApiModelProperty(value = "품목아이디")
        private String itemId;

    }
}
