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

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

@Getter
public enum CalcTypeEnum {

    CONSTRUCTION_AREA(1, "建筑面积"),
    USE_AREA(2, "使用面积"),
    QUOTA_CALCULATION(3, "定额计算"),
    ELECTRICITY_METER(4, "电表"),
    WATER_METER(5, "水表"),
    GAS_METER(6, "气表"),

    ;

    private final int value;
    private final String desc;

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

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