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

import lombok.Getter;
import org.nest.springwrap.core.log.exception.ServiceException;
@Getter
public enum CreateBillTypeEnum {

    CYCLE(1, "系统周期性生成"),
    METER(2, "抄表"),
    DEPOSIT(3, "交押金"),
    BEFOREHAND(4, "预收"),
    TEMPORARY(5, "临时收费"),
    BILL_SPLIT(6, "账单拆分"), // property_bill 表不会存这个值，账单拆分后create_bill_type保留原来的值
    SHARE_FEE(7, "固定金额分摊"),
    BUSINESS(8, "经营性收费"),

    ;

    private final int value;
    private final String desc;

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

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