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

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

@Getter
public enum PriceUnitTypeEnum {
    M2_MONTH(1, "m2/月"),
    MONTH(2, "月"),
    M2_DAY(3, "m2/天"),
    DAY(4, "天"),
    DU(5, "度"),
    M3(6, "m3"),
    M2(7, "m2"),
    GE(8, "个"),
    HOUR(9, "时"),

    ;

    private final int value;
    private final String desc;

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

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