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 PointRecommendLineRequest {

    @ApiModelProperty("线索ids")
    private List<Long> lineIds;

    @ApiModelProperty("铺位id")
    private Long pointId;

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

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

}
