package com.ruoyi.clock.enums;

import com.ruoyi.common.enums.IIntegerEnum;

import java.util.Objects;

/**
 * @author 打卡状态
 */
public enum ClockStatusEnum implements IIntegerEnum<Integer> {

    NORMAL(0, "正常"),
    EXPIRE(1, "结束"),
    ;

    private Integer code;
    private String msg;

    ClockStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

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

    @Override
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ClockStatusEnum getByCode(int code, ClockStatusEnum[] values) {
        for (ClockStatusEnum value : values) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }

}
