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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.ActionEntity;
import com.oqpo.api.entity.CodeEntity;
import com.oqpo.api.entity.oper.AfflEntity;
import com.oqpo.api.entity.oper.MemberEntity;
import com.oqpo.api.entity.oper.MenuEntity;
import com.oqpo.api.entity.stinfo.BrandEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.stream.Collectors;

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

    @ApiModelProperty(value = "브랜드 리스트")
    private List<BrandInfo> brandList;

    public static SessionBrandListResponse toDTO(List<BrandEntity> brandList) {
        if (brandList == null) return null;
        return SessionBrandListResponse.builder()
                .brandList(brandList.stream()
                        .map(m -> BrandInfo.builder()
                                .brandId(m.getBrandId())
                                .brandNm(m.getBrandNm())
                                .build())
                        .collect(Collectors.toList()))
                .build();
    }


    @Getter
    @Builder
    @AllArgsConstructor(access = AccessLevel.PROTECTED)
    static class BrandInfo {
        @ApiModelProperty(value = "브랜드아이디")
        private String brandId ;

        @ApiModelProperty(value = "브랜드명")
        private String brandNm;
    }

}
