package cn.wise.sc.energy.power.plant.business.domain.eum;

import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import lombok.Getter;

/**
 * @description: 检测特征 信号类型
 * @author: qh
 * @create: 2020-07-14 15:18
 **/
@Getter
public enum SignalTypeEnum {

    /**
     * 温度参数
     */
    T(1, "T"),
    /**
     * 机械参数
     */
    M(2, "M"),
    /**
     * 电气参数
     */
    E(3, "E"),
    /**
     * 辅机参数
     */
    A(4, "A")
    ;

    private Integer code;

    private String name;

    SignalTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据名字获取检测特征 信号类型
     *
     * @param name 条件
     * @return SignalTypeEnum
     */
    public static SignalTypeEnum getSignalTypeEnumByName(String name) {
        ResponseEnum.LICENCE_NOT_FOUND.assertNotEmpty(name);
        SignalTypeEnum[] values = SignalTypeEnum.values();
        SignalTypeEnum rts = null;
        for (SignalTypeEnum itemNameEnum : values) {
            if (itemNameEnum.getName().equals(name)) {
                rts = itemNameEnum;
            }
        }
        return rts;
    }

    /**
     * 返回枚举名字
     *
     * @return getName()
     */
    @Override
    public String toString() {
        return getName();
    }

}
