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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.stinfo.ItemClassMngEntity;
import com.oqpo.api.entity.stinfo.ItemUnitEntity;
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 StroeWishListResponse {
    @ApiModelProperty(value = "위시리스트")
    private List<StroeWishListResponse.WishListClass> wishList;

    public static StroeWishListResponse toDTO(List<ItemUnitEntity> entities) {
        if (entities == null) return null;
        return StroeWishListResponse.builder()
                .wishList(entities.stream()
                        .map(m -> WishListClass.builder()
                                .wishListMgntNo(m.getWishListMgntNo())
                                .wishListNm(m.getWishListNm())
                                .build())
                        .collect(Collectors.toList()))
                .build();
    }

    @Getter
    @Builder
    @AllArgsConstructor(access = AccessLevel.PROTECTED)
    static class WishListClass {
        @ApiModelProperty(value = "위시리스트번호")
        private String wishListMgntNo;

        @ApiModelProperty(value = "위시리스트명")
        private String wishListNm;

    }
}
