package com.cool.store.request;

import com.cool.store.entity.PointRecommendDO;
import com.cool.store.enums.point.PointRecommendStatusEnum;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

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

/**
 * @author zhangchenbiao
 * @FileName: RecommendPointRequest
 * @Description:
 * @date 2024-04-08 16:50
 */
@Data
public class LineRecommendPointRequest {

    @ApiModelProperty("线索id")
    private Long lineId;

    @ApiModelProperty("铺位ids")
    private List<Long> pointIds;

    @ApiModelProperty(value = "拓展经理", hidden = true)
    private String developmentManager;

    public List<PointRecommendDO> convertList(){
        if(Objects.isNull(this.lineId) || CollectionUtils.isEmpty(pointIds)){
            return Lists.newArrayList();
        }
        return this.pointIds.stream().map(pointId -> {
            PointRecommendDO pointRecommendDO = new PointRecommendDO();
            pointRecommendDO.setLineId(this.lineId);
            pointRecommendDO.setDevelopmentManager(this.developmentManager);
            pointRecommendDO.setPointId(pointId);
            pointRecommendDO.setStatus(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode());
            return pointRecommendDO;
        }).collect(Collectors.toList());
    }

}
