package com.yuchen.saas.park.api.enums.property;

import lombok.Getter;
import org.nest.springwrap.core.log.exception.ServiceException;

@Getter
public enum YesOrNoEnum {
    YES(1, "是/启用"),
    NO(0, "否/停用");

    private final int value;
    private final String desc;

    YesOrNoEnum(int i, String desc) {
        value = i;
        this.desc = desc;
    }

    public static YesOrNoEnum convert(int intValue) {
        YesOrNoEnum[] allValues = YesOrNoEnum.values();
        for(int i = 0; i < allValues.length; i++) {
            if(allValues[i].value == intValue) {
                return allValues[i];
            }
        }
        throw new ServiceException("YesOrNoEnum 非法枚举参数值");
    }

}
