package com.xxfc.platform.vehicle.pojo;

import com.github.wxiaoqi.security.common.vo.PageParam;
import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

@Data
public class UsableVeicleDTO extends PageParam {
        public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        @ApiModelProperty("城市")
        Integer addrCity;
        @ApiModelProperty("经度")
        Double lon;
        @ApiModelProperty("纬度")
        Double lat;
        @ApiModelProperty(hidden = true)
        String startDate;
        @ApiModelProperty(hidden = true)
        String endDate;
        @ApiModelProperty("开始时间戳")
        Long startDateTamp;
        @ApiModelProperty("结束时间戳")
        Long endDateTamp;
        @ApiModelProperty("开始价格")
        String priceStart;
        @ApiModelProperty("结束价格")
        String priceEnd;
        @ApiModelProperty("分类逗号分割")
        String catasStr;
        @ApiModelProperty(value = "分类列表", hidden = true)
        Map<Integer, List<VehiclePlatCata>> catas;

//        @ApiModelProperty(value = "一级分类列表", hidden = true)
//        Map<Integer, List<VehiclePlatCata>> pCatas;

        public void setStartDateTamp(Long startDateTamp) {
            this.startDateTamp = startDateTamp;
            this.startDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTamp), ZoneOffset.ofHours(8)));
        }

        public void setEndDateTamp(Long endDateTamp) {
                this.endDateTamp = endDateTamp;
                this.endDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(endDateTamp), ZoneOffset.ofHours(8)));
        }
}