package com.yuchen.saas.park.api.enums;

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

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/09/13 10:26
 * @Description: 设备手动分类
 * @Version: 1.0
 */
public enum DeviceTypeEnum {

    ENERGY_CONSUMPTION_TYPE_ENUM("网关设备", new String[]{
        // LoRaWAN网关
        IotProductEnum.LORAWAN_GATEWAY.getValue()
    }),

    MANHOLE_COVER_TYPE_ENUM("井盖设备", new String[]{
        // 井盖监测器
        IotProductEnum.MANHOLE_COVER_DEVICE.getValue()
    }),

    LIQUID_LEVEL_TYPE_ENUM("液位设备", new String[]{
        // 水压传感器
        IotProductEnum.WATER_PRESSURE_DEVICE.getValue()
    }),

    WEATHER_STATION_TYPE_ENUM("气象站设备", new String[]{
        // 风向传感器
        IotProductEnum.WIND_DIRECTION_DEVICE.getValue(),
        // 风速传感器
        IotProductEnum.WIND_SPEED_DEVICE.getValue(),
        // 雨量传感器
        IotProductEnum.RAINFALL_DEVICE.getValue(),
        // 气象站
        IotProductEnum.WEATHER_STATION_DEVICE.getValue()
    }),

    PH_TYPE_ENUM("酸碱度设备", new String[]{
        // 土壤酸碱度传感器
        IotProductEnum.SOIL_PH_DEVICE.getValue()
    }),

    ;
    /**
     * 存放该enum定义的所有的productKey
     */
    private static List<String> list = new ArrayList<>();
    static {
        // list设置值
        DeviceTypeEnum[] types = DeviceTypeEnum.values();
        for (DeviceTypeEnum deviceTypeEnum : types) {
            String[] category = deviceTypeEnum.getCategory();
            for (String productKey : category) {
                list.add(productKey);
            }
        }
    }
    /**
     * 手动分类名称
     */
    private String name;

    /**
     * 手动分类种类
     */
    private String[] category;

    DeviceTypeEnum(String type, String[] category) {
        this.name = type;
        this.category = category;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String[] getCategory() {
        return category;
    }

    public void setCategory(String[] category) {
        this.category = category;
    }

    /**
     * 获取手动分类的全部productKey
     * @return List<productKey>
     */
    public List<String> getCategoryList(){
        return this.list;
    }
}