package com.xzzn.common.enums;

/**
 * 电量类型
 */
public enum CostType
{
    PEAK("peak", "尖"),
    HIGH("high", "峰"),
    FLAT("flat", "平"),
    VALLEY("valley", "谷"),
    ;

    private final String code;
    private final String info;

    CostType(String code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public String getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }

    public static CostType getEnumByCode(String code)
    {
        for (CostType costType : CostType.values()) {
            if (costType.code.equals(code)) {
                return costType;
            }
        }
        return null;
    }
}
