package org.wcs.constant.enums.common;

import lombok.Getter;

@Getter
public enum OnOrOffEnum {

    UNKNOWN(-1, "未知"),
    TRUE(1, "启用"),
    FALSE(0, "停用");

    private final int code;
    private final String msg;

    OnOrOffEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static OnOrOffEnum getByCode(int code) {
        for (OnOrOffEnum value : OnOrOffEnum.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
