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

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

/**
 * 固定金额分摊方式
 */
@Getter
@AllArgsConstructor
public enum ShareTypeEnum {
    BY_USER(1, "按户分摊"),
    BY_AREA(2, "按建筑面积分摊"),

    ;

    private final int value;
    private final String desc;

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

}
