package cn.cecep.talroad.domain.vo;

import cn.cecep.talroad.common.core.annotation.Excel;
import cn.cecep.talroad.vo.EChartsVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 数据对比相关vo
 */
public class DataCompareVo {

    @Data
    @ApiModel("环比分析查询条件vo")
    public static class ChainSearchVo {
        @ApiModelProperty("区县/站点 1:区县, 2:站点")
        @NotNull(message = "区县/站点不可以为空 1:区县, 2:站点")
        private Integer qxOrStation;

        @ApiModelProperty("区县/站点id")
        @NotEmpty(message = "区县/站点id不可以为空")
        private String qxOrStationId;

        @ApiModelProperty("环比周期")
        @NotNull(message = "环比周期不可以为空")
        private Integer chainCycle;

        @ApiModelProperty("日期类型 day:日, week:周, month:月")
        private String timeType;

        @ApiModelProperty("日期值 不同日期类型格式, 日:yyyy-MM-dd, 周:yyyy-ww 月:yyyy-MM")
        @NotEmpty(message = "日期值不可以为空")
        private String timeValue;

        @ApiModelProperty(value = "开始日期, 不同日期类型格式不一样", hidden = true)
        private String startTime;
        @ApiModelProperty(value = "开始日期, 不同日期类型格式不一样", hidden = true)
        private String endTime;

    }

    @Data
    @ApiModel("环比分析返回数据vo")
    public static class ChainResponseVo {
        @ApiModelProperty("空气质量等级环比分析")
        private List<Row> rows;

        @ApiModelProperty("空气质量等级占比分析")
        private EChartsVO airLevelChart;

        @ApiModelProperty("首要污染物占比分析")
        private EChartsVO pollutantChart;

        @ApiModelProperty("浓度环比分析")
        private EChartsVO concentrationChart;
    }

    @Data
    @ApiModel("空气质量等级环比分析表格数据vo")
    public static class Row {
        @ApiModelProperty("时间")
        @Excel(name = "时间")
        private String time;

        @ApiModelProperty("选中天数")
        @Excel(name = "选中天数")
        private Long checkedCount;

        @ApiModelProperty("有效天数（空气质量级别不为空的）")
        @Excel(name = "有效天数")
        private Long levelValidCount;

        @ApiModelProperty("有效天数（首要污染物不为空的）")
        private Long pollutantValidCount;

        @ApiModelProperty("优天数（天）")
        @Excel(name = "优天数（天）")
        private Long veryGoodCount;

        @ApiModelProperty("良天数（天）")
        @Excel(name = "良天数（天）")
        private Long goodCount;

        @ApiModelProperty("严重污染天数（天）")
        private Long seriousCount;

        @ApiModelProperty("轻度污染天数（天）")
        @Excel(name = "轻度污染天数（天）")
        private Long slightCount;

        @ApiModelProperty("中度污染天数（天）")
        @Excel(name = "中度污染天数（天）")
        private Long moderateCount;

        @ApiModelProperty("重度污染天数（天）")
        @Excel(name = "重度污染天数（天）")
        private Long heavyCount;

        @ApiModelProperty("优良天数（天）")
        @Excel(name = "优良天数（天）")
        private Long fineCount;

        @ApiModelProperty("优良率（%）")
        @Excel(name = "优良率（%）")
        @JsonFormat(shape = JsonFormat.Shape.STRING)
        private BigDecimal fineRatio;
    }

    /**
     * 日数据vo
     */
    @Data
    public static class DayVo {
        private Date dataTime;
        private String week;
        private String month;
        private Integer fkAqilevelId;
        private String fkPollutantId;
        private BigDecimal aqi;
        private BigDecimal pm10;
        private BigDecimal pm25;
        private BigDecimal no2;
        private BigDecimal o3;
        private BigDecimal co;
        private BigDecimal so2;
        private BigDecimal pmi;
    }

    /**
     * 空气数据vo
     */
    @Data
    public static class AirDataVo {
        private String time; // day or week or month
        private BigDecimal aqi;
        private BigDecimal pm10;
        private BigDecimal pm25;
        private BigDecimal no2;
        private BigDecimal o3;
        private BigDecimal co;
        private BigDecimal so2;
        private BigDecimal pmi;
    }

}
