package com.limap.common.enums.iot;

/**
 * @author jjb
 * 控制器操作类型
 */

public enum ControllerOperateFlag {
    /**
     * 开关一
     */
    ONE("Switch1","Current1","Switch1_volt","switch1_VoltCur","rating_switch1","localTimer_switch1"),
    /**
     * 开关二
     */
    TWO("Switch2","Current2","Switch2_volt","switch2_VoltCur","rating_switch2","localTimer_switch2"),
    /**
     * 开关三
     */
    THREE("Switch3","Current3","Switch3_volt","switch3_VoltCur","rating_switch3","localTimer_switch3"),
    /**
     * 开关四
     */
    FOUR("Switch4","Current4","Switch4_volt","switch4_VoltCur","rating_switch4","localTimer_switch4");


    /**
     * 开关标识
     */
    private final String flag;
    /**
     * 电流标识
     */
    private final String currentFlag;
    /**
     * 开关额定电压
     */
    private final String voltFlag;
    /**
     * 电压电流标识
     */
    private final String voltCurFlag;
    /**
     * 额定电流标识
     */
    private final String ratingFlag;
    /**
     * 本地定时标识
     */
    private final String localTimerFlag;

    ControllerOperateFlag(String flag, String currentFlag, String voltFlag, String voltCurFlag, String ratingFlag, String localTimerFlag){
        this.flag = flag;
        this.currentFlag = currentFlag;
        this.voltFlag = voltFlag;
        this.voltCurFlag = voltCurFlag;
        this.ratingFlag = ratingFlag;
        this.localTimerFlag = localTimerFlag;
    }

    public static ControllerOperateFlag getByLocalTimerFlag(String flag) {
        for (ControllerOperateFlag e : ControllerOperateFlag.values()) {
            if (e.localTimerFlag.equals(flag)) {
                return e;
            }
        }
        return null;
    }

    public static ControllerOperateFlag getByFlag(String flag) {
        for (ControllerOperateFlag e : ControllerOperateFlag.values()) {
            if (e.flag.equals(flag)) {
                return e;
            }
        }
        return null;
    }

    public String getFlag() {
        return flag;
    }

    public String getCurrentFlag() {
        return currentFlag;
    }

    public String getVoltFlag() {
        return voltFlag;
    }

    public String getVoltCurFlag() {
        return voltCurFlag;
    }

    public String getRatingFlag() {
        return ratingFlag;
    }

    public String getLocalTimerFlag() {
        return localTimerFlag;
    }
}
