package com.gyee.alarm.model.vo;

import lombok.Data;

import java.io.Serializable;


public enum AlarmTime {

    H("h", "时"),
    M("m", "分"),
    S("s", "秒");

    private String code;
    private String name;

    AlarmTime(String code) {
        this.code = code;
    }

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

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据code获取message
     *
     * @param code
     * @return
     */
    public static String getNmaeByCode(String code) {
        for (AlarmTime ele : values()) {
            if (ele.getCode().equals(code)) {
                return ele.getName();
            }
        }
        return null;
    }


}
