package com.oqpo.api.web.dto.request.stinfo.item;

import com.oqpo.api.entity.stinfo.ItemClassMngEntity;
import com.oqpo.api.entity.stinfo.SpplyMgrEntity;
import com.oqpo.api.web.dto.request.auth.SaveAuthRequest;
import com.oqpo.api.web.dto.request.stinfo.spply.SaveSpplyRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class DelItemInfolRequest {


    @ApiModelProperty(value = "삭제상세리스트")
    private List<DelItemInfolRequest.DelItemClassMng> gridDeleteData;

    public List<ItemClassMngEntity> toCodeEntities(List< DelItemInfolRequest.DelItemClassMng > gridData) {
        List<ItemClassMngEntity> entities = new ArrayList<>();
        if (gridData == null || gridData.size() == 0)
            return entities;

        gridData.forEach(x -> {
            ItemClassMngEntity entity = new ItemClassMngEntity();
            entity.setItemClassMgntNo(x.getItemClassMgntNo());
            entities.add(entity);
        });
        return entities;
    }

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

        @NotBlank
        @ApiModelProperty(value = "품목분류번호")
        private String itemClassMgntNo;
    }
}
