package com.cool.store.vo.point;

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

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class MiniPointPageVO {

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

    @ApiModelProperty("铺位名称")
    private String pointName;

    @ApiModelProperty("铺位编号")
    private String pointCode;

    @ApiModelProperty("所属站区")
    private String regionNodeName;

    @ApiModelProperty("地址")
    private String address;

    @ApiModelProperty("铺位得分")
    private Integer pointScore;

    @ApiModelProperty("铺位面积")
    private String pointArea;

    @ApiModelProperty("1.待选择 2.已选择 3.已被他人选择 4.已签约 5.已拒绝 6.已失效")
    private Integer recommendStatus;

    public static List<MiniPointPageVO> convertVO(List<MiniPointPageDTO> pointList, Map<Long, String> regionNameMap, Long curLineId) {
        if(CollectionUtils.isEmpty(pointList)){
            return Lists.newArrayList();
        }
        List<MiniPointPageVO> resultList = new ArrayList<>();
        for (MiniPointPageDTO pointInfo : pointList) {
            MiniPointPageVO pointPageVO = new MiniPointPageVO();
            pointPageVO.setPointId(pointInfo.getPointId());
            pointPageVO.setPointName(pointInfo.getPointName());
            pointPageVO.setPointCode(pointInfo.getPointCode());
            pointPageVO.setRegionNodeName(regionNameMap.get(pointInfo.getRegionId()));
            pointPageVO.setAddress(pointInfo.getAddress());
            pointPageVO.setPointScore(pointInfo.getPointScore());
            pointPageVO.setPointArea(pointInfo.getPointArea());
            pointPageVO.setRecommendStatus(pointInfo.getRecommendStatus());
            resultList.add(pointPageVO);
        }
        return resultList;
    }
}