package org.wcs.constant.enums.common;

import lombok.Getter;

@Getter
public enum TrueOrFalseEnum {

    UNKNOWN(-1, "未知"),
    TRUE(1, "是"),
    FALSE(0, "否");

    private final int code;
    private final String msg;

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

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

}
