package cn.cecep.talroad.vo;

import cn.cecep.talroad.common.core.exception.ServiceException;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Author: weizhuang
 * @Date:2023/2/6 15:10
 * @Version 1.0
 */
@Data
@ApiModel("echartsVo")
public class ChartVo {
    private Object[] legendData;
    private Object[] xsxisData;
    private List<Map<Object, Object>> yaxisData;
    private List<Map<Object, Object>> seriesData;
    // ...

    /**
     * 空气污染物
     */
    public enum AirPollutant {

        P_1("SO₂","二氧化硫", "μg/m³"),

        P_2("NOₓ","氮氧化物", "μg/m³"),

        P_3("颗粒物","颗粒物", ""),

        P_4("VOCs","挥发性有机物", "");

        public String code;
        public String desc;
        public String unit;

        public static ChartVo.AirPollutant getByCode(String code) {
            return Arrays.stream(ChartVo.AirPollutant.values())
                    .filter(enums -> enums.code.equals(code)).findFirst().orElseThrow(() -> new ServiceException("EnumException"));
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public String getUnit() {
            return unit;
        }

        AirPollutant(String code, String desc, String unit) {
            this.code = code;
            this.desc = desc;
            this.unit = unit;
        }
    }


    /**
     * 空气污染物
     */
    public enum WaterPollutant {

        P_1("COD","化学需氧量", ""),

        P_2("氨氮","氨氮", ""),

        P_3("总氮","总氮", ""),

        P_4("总磷","总磷", "");

        public String code;
        public String desc;
        public String unit;

        public static ChartVo.WaterPollutant getByCode(String code) {
            return Arrays.stream(ChartVo.WaterPollutant.values())
                    .filter(enums -> enums.code.equals(code)).findFirst().orElseThrow(() -> new ServiceException("EnumException"));
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public String getUnit() {
            return unit;
        }

        WaterPollutant(String code, String desc, String unit) {
            this.code = code;
            this.desc = desc;
            this.unit = unit;
        }
    }

    /**
     * s_env_gas_mon_real表污染物
     */
    public enum EnvGasMonRealPollutant {

        P_1("二氧化硫","SO₂", "mg/m³", "so2"),
//        P_2("二氧化硫折算","二氧化硫折算", "ug/m³", "so2Convert"),
        P_3("氮氧化物","NOx", "mg/m³", "nox"),
//        P_4("氮氧化物折算","氮氧化物折算", "ug/m³", "noxConvert"),
//        P_5("一氧化氮","一氧化氮", "ug/m³", "no"),
//        P_6("一氧化氮折算","一氧化氮折算", "ug/m³", "noConvert"),
//        P_7("二氧化氮","二氧化氮", "ug/m³", "no2"),
//        P_8("二氧化氮折算","二氧化氮折算", "ug/m³", "no2Convert"),
//        P_9("烟尘","烟尘", "ug/m³", "smokeDust"),
//        P_10("烟尘折算","烟尘折算", "ug/m³", "smokeDustConvert"),
//        P_11("氧气含量","氧气含量", "ug/m³", "o3"),
//        P_12("废气","废气", "ug/m³", "oxygen"),
//        P_13("烟气温度","烟气温度", "℃", "smokeDustTem"),
//        P_14("烟气压力","烟气压力", "Pa", "smokeDustPressure"),
//        P_15("烟气流速","烟气流速", "m/s", "smokeDustFlowVelocity"),
//        P_16("烟气湿度","烟气湿度", "%RH", "smokeDustHumidity"),
          P_17("VOCs","VOCs", "mg/m³", "vocs"),
          P_18("颗粒物","颗粒物", "mg/m³", "pm");

        public String code;
        public String desc;
        public String unit;
        public String column;

        public static ChartVo.EnvGasMonRealPollutant getByCode(String code) {
            return Arrays.stream(ChartVo.EnvGasMonRealPollutant.values())
                    .filter(enums -> enums.code.equals(code)).findFirst().orElseThrow(() -> new ServiceException("EnumException"));
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public String getUnit() {
            return unit;
        }

        public String getColumn() {
            return column;
        }

        EnvGasMonRealPollutant(String code, String desc, String unit, String column) {
            this.code = code;
            this.desc = desc;
            this.unit = unit;
            this.column = column;
        }
    }

    /**
     * s_env_water_mon_real表污染物
     */
    public enum EnvGasWaterRealPollutant {

        P_1("COD","COD", "mg/L", "codConcentration"),
        P_2("总磷","总磷", "mg/m³", "phosphorusConcentration"),
        P_3("总氮","总氮", "mg/m³", "nitrogenConcentration"),
        P_4("氨氮","氨氮", "mg/m³", "ammoniaNitrogen");

        public String code;
        public String desc;
        public String unit;
        public String column;

        public static ChartVo.EnvGasWaterRealPollutant getByCode(String code) {
            return Arrays.stream(ChartVo.EnvGasWaterRealPollutant.values())
                    .filter(enums -> enums.code.equals(code)).findFirst().orElseThrow(() -> new ServiceException("EnumException"));
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public String getUnit() {
            return unit;
        }

        public String getColumn() {
            return column;
        }

        EnvGasWaterRealPollutant(String code, String desc, String unit, String column) {
            this.code = code;
            this.desc = desc;
            this.unit = unit;
            this.column = column;
        }
    }
}
