package com.cool.store.vo.point;

import com.cool.store.entity.PointInfoDO;
import com.cool.store.enums.point.PointStatusEnum;
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.Date;
import java.util.List;
import java.util.Map;

/**
 * @author zhangchenbiao
 * @FileName: PointToDoVO
 * @Description:
 * @date 2024-04-22 14:56
 */
@Data
public class PointToDoVO {

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

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

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

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

    @ApiModelProperty("提交时间")
    private Date submitTime;

    public static List<PointToDoVO> convertVO(List<PointInfoDO> pointList, Map<Long, String> regionNameMap, Map<Long, Date> submitTimeMap) {
        if(CollectionUtils.isEmpty(pointList)){
            return Lists.newArrayList();
        }
        List<PointToDoVO> resultList = new ArrayList<>();
        for (PointInfoDO pointInfo : pointList) {
            PointToDoVO pointPageVO = new PointToDoVO();
            pointPageVO.setPointId(pointInfo.getId());
            pointPageVO.setPointName(pointInfo.getPointName());
            pointPageVO.setRegionNodeName(regionNameMap.get(pointInfo.getRegionId()));
            pointPageVO.setAddress(pointInfo.getAddress());
            pointPageVO.setSubmitTime(submitTimeMap.get(pointInfo.getId()));
            resultList.add(pointPageVO);
        }
        return resultList;
    }

}
