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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.oper.FileEntity;
import com.oqpo.api.entity.stinfo.ItemClassMngEntity;
import com.oqpo.api.entity.stinfo.ItemEntity;
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 ItemClassMngInfoResponse {

    @ApiModelProperty(value = "브랜드번호")
    private String brandId;

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

    @ApiModelProperty(value = "Level1")
    private String itemClass1;

    @ApiModelProperty(value = "Level2")
    private String itemClass2;

    @ApiModelProperty(value = "Level3")
    private String itemClass3;

    @ApiModelProperty(value = "Level4")
    private String itemClass4;

    @ApiModelProperty(value = "품목분류명")
    private String itemClassNm;

    @ApiModelProperty(value = "출력순번")
    private Integer prnSeq;

    public static ItemClassMngInfoResponse toDTO(ItemClassMngEntity entity) {
        if (entity == null) return null;
        return ItemClassMngInfoResponse.builder()
                .brandId(entity.getBrandId())
                .itemClassMgntNo(entity.getItemClassMgntNo())
                .itemClassNm(entity.getItemClassNm() == null ? "" : entity.getItemClassNm() )
                .itemClass1(entity.getItemClass1() == null ? "" : entity.getItemClass1())
                .itemClass2(entity.getItemClass2() == null ? "" : entity.getItemClass2())
                .itemClass3(entity.getItemClass3() == null ? "" : entity.getItemClass3())
                .itemClass4(entity.getItemClass4() == null ? "" : entity.getItemClass4())
                .prnSeq(entity.getPrnSeq() == null ? 99 : entity.getPrnSeq())
                .build();
    }

}
