package com.jiayue.ipfcst.common.data.constant.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sun.org.apache.xpath.internal.objects.XBoolean;
import lombok.AllArgsConstructor;
import lombok.Getter;

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

/**
 * 设备数据对象类型枚举
 * lastModify
 * 2020.3.26  修唯   枚举名修改，新增发电站类型，删除各种功率，设备数，开机容量等类型
 *
 * @author zzy
 * @version 1.0
 * @since 2019/8/19 8:59
 */
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum EquipmentTypeEnum {

    /**
     * 场站也视为设备类型的一种
     */
    POWERSTATION(0, "光伏发电站"),
    WEATHERSTATION(1, "气象站"),
    INVERTER(2, "逆变器"),
    WINDTOWER(3, "测风塔"),
    WINDTURBINE(4, "风机"),
    FORECASTDATA(5, "预测数据"),
    BOOSTERSTATION(6, "升压站"),
    AGC_AVC(7, "AGC_AVC"),
    BWD(8, "并网点"),
    CYB(9, "厂用变"),
    JDX(10, "集电线"),
    SYZMX(11, "升压站母线"),
    WGBC(12, "无功补偿"),
    DLQ(13, "断路器"),
    DZ(14, "刀闸"),
    JDDZ(15, "接地刀闸"),
    DXFDJ(16, "等效发电机"),
    QBB(17, "启备变"),
    LLB(18, "联络变"),
    FZ(19, "方阵"),
    XB(20,"箱变"),
    POWERSTATION2(21, "风电发电站");

    private Integer code;
    private String message;


    /**
     * 附属设备
     */
    public static final List<EquipmentTypeEnum> SUBSIDIARY_EQUIPMENT_TYPE = Arrays.asList(
            EquipmentTypeEnum.JDX,//并网点
            EquipmentTypeEnum.BWD,//并网点
            EquipmentTypeEnum.CYB,//厂用变
            EquipmentTypeEnum.SYZMX,//升压站母线
            EquipmentTypeEnum.WGBC,//"无功补偿
            EquipmentTypeEnum.DLQ,//"断路器
            EquipmentTypeEnum.DZ,//"刀闸
            EquipmentTypeEnum.JDDZ,//"接地刀闸
            EquipmentTypeEnum.DXFDJ,//"等效发电机
            EquipmentTypeEnum.QBB,//"启备变
            EquipmentTypeEnum.LLB,//"联络变
            EquipmentTypeEnum.FZ,//方阵
            EquipmentTypeEnum.XB//箱变
    );


    public static EquipmentTypeEnum valueOf(Integer code) {
        switch (code) {
            case 0:
                return POWERSTATION;
            case 1:
                return WEATHERSTATION;
            case 2:
                return INVERTER;
            case 3:
                return WINDTOWER;
            case 4:
                return WINDTURBINE;
            case 5:
                return FORECASTDATA;
            case 6:
                return BOOSTERSTATION;
            case 7:
                return AGC_AVC;
            case 8:
                return BWD;
            case 9:
                return CYB;
            case 10:
                return JDX;
            case 11:
                return SYZMX;
            case 12:
                return WGBC;
            case 13:
                return DLQ;
            case 14:
                return DZ;
            case 15:
                return JDDZ;
            case 16:
                return DXFDJ;
            case 17:
                return QBB;
            case 18:
                return LLB;
            case 19:
                return FZ;
            case 20:
                return XB;
            case 21:
                return POWERSTATION2;
        }
        return null;
    }
}
