package com.sonic.cow.enums;

import com.sonic.lion.lib.enums.BizType;
import lombok.Getter;

@Getter
public enum DeductionTypeEnum {
    //文本
    TEXT(1, 100L, BizType.TEXT_MODEL),
    //发送或听取语音
    VOICE(2, 1000L, BizType.SEND_VOICE),
    //语音通话
    VOICE_CALL(3, 2000L, BizType.VOICE_CALL),

    ;
    private final Integer index;

    /**
     * 每一次预扣除金额 单位分
     */
    private final Long amount;

    /**
     * 对应的付款类型
     */
    private final BizType bizType;

    DeductionTypeEnum(Integer index, Long amount, BizType bizType) {
        this.index = index;
        this.amount = amount;
        this.bizType = bizType;
    }

    /**
     * 通过索引获取枚举
     *
     * @param index
     * @return
     */
    public static DeductionTypeEnum getDeductionTypeEnum(Integer index) {
        for (DeductionTypeEnum value : DeductionTypeEnum.values()) {
            if (value.index.equals(index)) {
                return value;
            }
        }
        return null;
    }
}
