/**
 *
 */
package com.huatek.busi.common;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import lombok.Getter;

/**
 * @ClassName: SiteConstants
 * @FullClassPath: com.busi.back.common.SiteConstants
 * @Description:站点常量类.
 * @author: Arno
 * @date: Jun 24, 2019 3:48:23 PM
 * @version: 1.0
 */
public class SiteConstants{
    /**
     * @ClassName: SiteTreeEnum
     * @FullClassPath: com.busi.back.common.SiteTreeEnum
     * @Description: 站点树节点枚举</br>
     *               -1：根节点 ; 0: 站点; 1：变压器 ; 2: GIS ; 3: 测温 ; 4：避雷器;
     *               <p>
     *               21:GIS回路 ; 31:测温柜回路 ; 41：避雷器回路;
     *               <p>
     *               111: 变压器设备; 211：GIS设备 ; 311：测温设备 ; 411：避雷器设备; 511：其他;
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum SiteTreeEnum {
        /** 根节点 */
        ROOT("-1", "根节点"),
        /** 站点 */
        SITE("0", "站点"),
        /** 变压器 */
        BYQ("1", "变压器"),
        /** GIS设备 */
        GIS("2", "GIS设备"),
        /** 测温 */
        CW("3", "测温 "),
        /** 避雷器 */
        BLQ("4", "避雷器"),
        /** 发电机 */
        GEN("6", "发电机"),
        /** 其他类 */
        OTHER("5", "其他"),
        /** 电缆 */
        DL("7", "电缆"),

        GIS_HL("21", "GIS间隔"),

        CW_HL("31", "测温柜回路 "),

        BLQ_HL("41", "避雷器回路"),

        GEN_HL("61", "发电机"),

        DL_HL("71", "电缆"),

//        OTHER_HL("51", "其他"),

        BYQ_EQM("111", "变压器"),

        GIS_HL_EQM("211", "GIS"),

        CW_HL_EQM("311", "开关柜 "),

        BLQ_HL_EQM("411", "出线场"),

        GEN_EQM("611", "发电机"),

        OTHER_EQM("511", "其他"),

        DL_EQM("711", "电缆");

        private SiteTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
            Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                .collect(Collectors.toList());

        public static SiteTreeEnum fromValue(String value) {
            return Arrays.stream(values()).filter(e -> e.getValue().equals(value)).findFirst().orElse(null);
        }
    }

    /**
     * @ClassName: TransfromerTreeEnum
     * @FullClassPath: com.busi.back.common.TransfromerTreeEnum
     * @Description: 变压器外挂设备树节点枚举</br>
     *               0：主设备
     *               <p>
     *               01：油色谱类型 ; 02：局放类型 ; 03：铁芯装置类型 ; 04：红外本体类型 ; 05：图片数据类型 ; 06：容性设备类型 07：气象装置类型; 08：夹件装置类型; 09：套管装置类型
     *               <p>
     *               011：油色谱设备 ; 021：局放设备 ; 031：铁芯装置设备 ; 041：红外本体设备 ; 051：图片数据设备 ; 061：容性设备 ; 071：气象装置设备 ; 081：夹件装置设备 ;
     *               091：套管
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum TransfromerTreeEnum {
        /** 根节点 */
        ROOT("0", "根节点"),

        YSP("01", "油色谱"),

        JF("02", "局放信号"),

        TX("03", "铁芯装置 "),

        HW("04", "红外本体"),

        TP("05", "图片数据"),

        RX("06", "容性设备"),

        QX("07", "气象装置"),

        JJ("08", "夹件装置"),

        TG("09", "套管装置"),

        SJZD("10", "声级振动"),

        RZCW("11","绕组测温"),

        YSP_EQM("011", "油色谱"),

        JF_EQM("021", "局放信号"),

        TX_EQM("031", "铁芯装置 "),

        HW_EQM("041", "红外"),

        TP_EQM("051", "图片数据"),

        RX_EQM("061", "容性设备"),

        QX_EQM("071", "气象装置"),

        JJ_EQM("081", "夹件装置"),

        TG_EQM("091", "套管装置"),

        SJZD_EQM("101", "声级振动"),

        DLHL_EQM("111", "电缆环流"),

        RZCW_EQM("121", "绕组测温");

        private TransfromerTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
            Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                .collect(Collectors.toList());

        public static String getName(String value) {
        	TransfromerTreeEnum[] transfromerTreeEnums = values();
            for (TransfromerTreeEnum transfromerTreeEnum : transfromerTreeEnums) {
                if (transfromerTreeEnum.getValue().equals(value)) {
                    return transfromerTreeEnum.getName();
                }
            }
            return null;
        }

        public static TransfromerTreeEnum fromValue(String value) {
            return Arrays.stream(values()).filter(e -> e.value.equals(value)).findFirst().orElse(null);
        }
    }


    /**
     * @ClassName: TransfromerTreeEnum
     * @FullClassPath: com.busi.back.common.TransfromerTreeEnum
     * @Description: 变压器外挂设备树节点枚举</br>
     *               0：主设备
     *               <p>
     *               01：油色谱类型 ; 02：局放类型 ; 03：铁芯装置类型 ; 04：红外本体类型 ; 05：图片数据类型 ; 06：容性设备类型 07：气象装置类型; 08：夹件装置类型; 09：套管装置类型
     *               <p>
     *               011：油色谱设备 ; 021：局放设备 ; 031：铁芯装置设备 ; 041：红外本体设备 ; 051：图片数据设备 ; 061：容性设备 ; 071：气象装置设备 ; 081：夹件装置设备 ;
     *               091：套管
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum GeneratorTreeEnum {
        /** 根节点 */
        ROOT("0", "根节点"),

        YSP("01", "油色谱"),

        JF("02", "局放信号"),

        TX("03", "铁芯装置 "),

        HW("04", "红外本体"),

        TP("05", "图片数据"),

        RX("06", "容性设备"),

        QX("07", "气象装置"),

        JJ("08", "夹件装置"),

        TG("09", "套管装置"),

        SJZD("10", "声级振动"),

        YSP_EQM("011", "油色谱"),

        JF_EQM("021", "局放信号"),

        TX_EQM("031", "铁芯装置 "),

        HW_EQM("041", "红外"),

        TP_EQM("051", "图片数据"),

        RX_EQM("061", "容性设备"),

        QX_EQM("071", "气象装置"),

        JJ_EQM("081", "夹件装置"),

        TG_EQM("091", "套管装置"),

        SJZD_EQM("101", "声级振动"),

        DLHL_EQM("111", "电缆环流");

        private GeneratorTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
                Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                        .collect(Collectors.toList());

        public static String getName(String value) {
            GeneratorTreeEnum[] generatorTreeEnums = values();
            for (GeneratorTreeEnum generatorTreeEnum : generatorTreeEnums) {
                if (generatorTreeEnum.getValue().equals(value)) {
                    return generatorTreeEnum.getName();
                }
            }
            return null;
        }

        public static GeneratorTreeEnum fromValue(String value) {
            return Arrays.stream(values()).filter(e -> e.value.equals(value)).findFirst().orElse(null);
        }
    }

    /**
     * @ClassName: GisTreeEnum
     * @FullClassPath: com.busi.back.common.GisTreeEnum
     * @Description: GIS外挂设备树节点枚举</br>
     *               0：主设备
     *               <p>
     *               01：GIS局放监测类型; 02：SF6微水，压力， 温度监测类型; 03：GIS机械特性监测类型; 04：气象装置类型; 05：红外监测类型; 06： 图片数据类型
     *               <p>
     *               011：GIS局放监测设备; 021：SF6微水，压力， 温度监测设备; 031：GIS机械特性监测设备; 041：气象装置设备; 051：红外监测设备; 061：图片数据设备
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum GisTreeEnum {
        /** 根节点 */
        ROOT("0", "根节点"),

        JF("01", "GIS局放监测  "),

        SF6("02", "SF6微水，压力， 温度监测"),

        JXTX("03", "GIS机械特性监测 "),

        HJJC("07","SF6环境监测"),

        QX("04", "气象装置"),

        HW("05", "红外监测"),

        TP("06", "图片数据"),

        JF_EQM("011", "GIS局放监测"),

        SF6_EQM("021", "SF6微水，压力， 温度监测"),

        JXTX_EQM("031", "GIS机械特性监测 "),

        QX_EQM("041", "气象装置"),

        HW_EQM("051", "红外监测"),

        TP_EQM("061", "图片数据");

        private GisTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
            Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                .collect(Collectors.toList());

        public static String getName(String value) {
        	GisTreeEnum[] gisTreeEnums = values();
            for (GisTreeEnum gisTreeEnum : gisTreeEnums) {
                if (gisTreeEnum.getValue().equals(value)) {
                    return gisTreeEnum.getName();
                }
            }
            return null;
        }
    }

    /**
     * @ClassName: ArresterTreeEnum
     * @FullClassPath: com.busi.back.common.ArresterTreeEnum
     * @Description: 避雷器外挂设备树节点枚举</br>
     *               0：主设备
     *               <p>
     *               01：绝缘监测类型; 02：红外套管监测类型; 03：容性设备监测类型; 04：气象装置监测类型; 05： 图片数据监测类型
     *               <p>
     *               011：绝缘设备; 021：红外套管设备; 031：容性设备设备; 041：气象装置设备; 051： 图片数据设备
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum ArresterTreeEnum {
        /** 根节点 */
        ROOT("0", "根节点"),

        JY("01", "绝缘监测"),

        HW("02", "红外套管"),

        RX("03", "容性设备 "),

        QX("04", "气象装置"),

        TP("05", "图片数据"),

        JY_EQM("011", "绝缘监测  "),

        HW_EQM("021", "红外套管"),

        RX_EQM("031", "容性设备 "),

        QX_EQM("041", "气象装置"),

        TP_EQM("051", "图片数据");

        private ArresterTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
            Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                .collect(Collectors.toList());

        public static String getName(String value) {
        	ArresterTreeEnum[] arresterTreeEnums = values();
            for (ArresterTreeEnum arresterTreeEnum : arresterTreeEnums) {
                if (arresterTreeEnum.getValue().equals(value)) {
                    return arresterTreeEnum.getName();
                }
            }
            return null;
        }
    }

    /**
     * 电缆枚举
     */
    public enum CableTreeEnum {
        ROOT("0", "根节点"),
        CABLE_PARTIAL_DISCHARGE("01", "电缆局放"),
        CABLE_CIRCULATION("02", "电缆环流"),
        CABLE_TRENCH("03", "电缆沟"),
        HW("04", "红外测温"),
        DLGHJJC("05", "电缆沟环境监测"),
        GYDLGQCW("06", "高压电缆光纤测温"),
        DLJF_EQM("011", "电缆局放"),
        DLHL_EQM("021", "电缆环流"),
        DLG_EQM("031", "电缆沟"),
        HW_EQM("041", "红外测温");

        CableTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
                Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                        .collect(Collectors.toList());

        public static String getName(String value) {
            CableTreeEnum[] cableTreeEnums = values();
            for (CableTreeEnum cableTreeEnum : cableTreeEnums) {
                if (cableTreeEnum.getValue().equals(value)) {
                    return cableTreeEnum.getName();
                }
            }
            return null;
        }
    }


    public static enum OtherTreeEnum {
        /** 根节点 */
        ROOT("0", "根节点"),

        DL("01", "电缆局放"),

        HW("02", "红外热成像"),

        TX("03", "图像数据"),

        DLHL("04", "电缆环流"),

        DL_EQM("011", "电缆局放"),

        HW_EQM("021", "红外热成像"),

        TX_EQM("031", "图像数据"),

    	DLHL_EQM("041", "电缆环流");

        private OtherTreeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;

        public static final List<ValueNamePair> EQM_LIST =
            Arrays.stream(values()).filter(e -> e.getValue().length() == 3).map(e -> new ValueNamePair(e.value, e.name))
                .collect(Collectors.toList());

        public static String getName(String value) {
        	OtherTreeEnum[] otherTreeEnums = values();
            for (OtherTreeEnum otherTreeEnum : otherTreeEnums) {
                if (otherTreeEnum.getValue().equals(value)) {
                    return otherTreeEnum.getName();
                }
            }
            return null;
        }
    }

    /**
     * @ClassName: Status
     * @FullClassPath: com.busi.back.common.Status
     * @Description: 数据状态枚举定义：1——正常；2——删除
     * @author: Arno
     * @date: Jun 24, 2019 3:57:09 PM
     * @version: 1.0
     */
    public static enum Status {
        /** 删除 */
        DELETE("2", "删除"),

        NORMAL("1", "正常");

        private Status(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;
    }

    /** 变压器 */
    public static final String BYQ = "1";
    /** GIS设备 */
    public static final String GIS = "2";
    /** 测温 */
    public static final String CW = "3";
    /** 避雷器 */
    public static final String BLQ = "4";
    /** 其他 */
    public static final String OTHER = "5";
    /** 电缆 */
    public static final String DL = "7";

    public static final String GEN = "6";
    /**
     * 局放类型
     * <p>
     * p: 变压器 ; g: GIS; d:电缆
     *
     * @author anker_cheng
     * @date 2019/07/31
     */
    public static enum PdTypeEnum {
        /** 变压器 */
        BYQ("p", "变压器"),
        /** GIS */
        GIS("g", "GIS"),
        /** 电缆 */
        DL("d", "电缆");

        private PdTypeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;
    }

    /**
     * 外挂设备设备类型
     * <p>
     * 1：变压器; 2:GIS; 3:测温; 4：避雷器; 5:其他
     *
     * @author anker_cheng
     * @date 2019/07/31
     */
    public static enum ExternalTypeEnum {
        /** 变压器 */
        BYQ("1", "变压器"),
        /** GIS设备 */
        GIS("2", "GIS设备"),
        /** 测温 */
        CW("3", "测温 "),
        /** 避雷器 */
        BLQ("4", "避雷器"),
        /** 其他 */
        OTHER("5", "其他"),
        /** 发电机 */
        GEN("6","发电机"),
        /** 电缆 */
        DL("7", "电缆");


        private ExternalTypeEnum(String value, String name) {
            this.value = value;
            this.name = name;

        }
        @Getter
        private final String value;
        @Getter
        private final String name;

        public static ExternalTypeEnum fromValue(String value) {
            return Arrays.stream(values()).filter(e -> e.getValue().equals(value)).findFirst().orElse(null);
        }
    }


    public static enum IecTypeEnum {
        /** 电站状态 */
        FD("1", "发电"),
        /** GIS设备 */
        CS("2", "抽水"),
        /** 测温 */
        KX("3", "空闲");

        private IecTypeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;

        public static IecTypeEnum fromValue(String value) {
            return Arrays.stream(values()).filter(e -> e.getValue().equals(value)).findFirst().orElse(null);
        }

        public static String getName(String value) {
        	IecTypeEnum[] iecTypeEnums = values();
            for (IecTypeEnum iecTypeEnum : iecTypeEnums) {
                if (iecTypeEnum.getValue().equals(value)) {
                    return iecTypeEnum.getName();
                }
            }
            return null;
        }
    }

    /**
	 * 	通信类型
	 *  yx：遥信  yc:遥测
	 *
	 */
    public static enum TxTypeEnum {

        YX("1","遥信"),
        YC("2","遥测");

        private TxTypeEnum(String value,String name){
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;
	}

    /**
     * 铁芯/夹件常量
     *
     * @author anker_cheng
     * @date 2019/08/02
     */
    public static enum IcgeType {
        /** 铁芯 */
        TX("1", "铁芯"),
        /** 夹件 */
        JJ("2", "夹件");

        private IcgeType(String value, String name) {
            this.value = value;
            this.name = name;
        }
        @Getter
        private final String value;
        @Getter
        private final String name;
        public static String getName(String value) {
        	IcgeType[] icgeTypeEnums = values();
            for (IcgeType icgeTypeEnum : icgeTypeEnums) {
                if (icgeTypeEnum.getValue().equals(value)) {
                    return icgeTypeEnum.getName();
                }
            }
            return null;
        }
    }

    /**
     * 相位常量
     *
     * @author edward_luo
     * @date 2019/10/28
     */
    public static enum PositionType {
        /** A相 */
        AX("1", "A相"),
        /** B相 */
        BX("2", "B相"),
        /** C相 */
        CX("3", "C相"),
        /** 全相 */
        QX("0", "全相");


        private PositionType(String value, String name) {
            this.value = value;
            this.name = name;
        }

        @Getter
        private final String value;
        @Getter
        private final String name;

        public static String getName(String value) {
            PositionType[] positionTypeEnums = values();
            for (PositionType positionTypeEnum : positionTypeEnums) {
                if (positionTypeEnum.getValue().equals(value)) {
                    return positionTypeEnum.getName();
                }
            }
            return null;
        }
    }

    public static String getIecTypeDescribe(String status) {
        IecTypeEnum iecTypeEnum = IecTypeEnum.fromValue(status);
        return iecTypeEnum == null ? "" : iecTypeEnum.getName();
    }
}
