package com.sonic.lion.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.sonic.common.utils.MessageUtils;
import lombok.Getter;

/**
 * @author: code
 * @date: 2025/05/07
 * @Description: 交易类型
 * @version: 1.0.0
 */
@Getter
public enum BizType {

    /**
     * 游戏
     */
    GAME(10, "Game", TradeType.SECURED_TRANSACTION),
    /**
     * 充值
     */
    CHARGE(100, "Buff Charge", TradeType.CHARGE),
    /**
     * 订阅类型
     */
    SUB(150, "sub", TradeType.SUB),
    /**
     * buff 提现
     */
    WITHDRAW(200, "Withdraw", TradeType.WITHDRAW),
    /**
     * 退款
     */
    REFUND(300, "Refund", TradeType.REFUND),
    /**
     * 冻结余额
     */
    FROZEN_BALANCE(400, "Buff Frozen", TradeType.NON_SECURED_TRANSACTION),
    /**
     * 解冻余额
     */
    UNFROZEN_BALANCE(500, "Buff Unfrozen", TradeType.NON_SECURED_TRANSACTION),
    /**
     * 创建图片
     */
    CREATE_AI_IMAGE(610, "Create AI Image", TradeType.C2B),
    /**
     * 文本模型
     */
    TEXT_MODEL(620, "Text Model", TradeType.C2B),
    /**
     * 聊天辅助
     */
    CHAT_ASSISTANT(630, "Chat Assistant", TradeType.C2B),
    /**
     * 发送语音
     */
    SEND_VOICE(640, "Send Voice", TradeType.C2B),
    /**
     * 语音电话
     */
    VOICE_CALL(650, "Voice Call", TradeType.C2B),
    /**
     * 解锁上锁图片（10%计入官方虚拟账户，90%归用户虚拟钱包）
     */
    IMAGE_UNLOCK(700, "Image Unlock", TradeType.NON_SECURED_TRANSACTION),
    /**
     * 购买心动值
     */
    HEARTBEAT_PURCHASE(800, "Heartbeat Purchase", TradeType.C2B),
    /**
     * 虚拟礼物（10%计入官方虚拟账户，90%归用户虚拟钱包）
     */
    GIFT(900, "Gift", TradeType.NON_SECURED_TRANSACTION),
    /**
     * 解锁爱慕者
     */
    UNLOCK_ADMIRERS(1000, "Unlock Admirers", TradeType.C2B),

    /**
     * 新注册用户赠送
     */
    NEW_USER_GIFT(1001, "New User Gift", TradeType.NON_SECURED_TRANSACTION),

    /**
     * VIP用户赠送
     */
    VIP_BUFF_GIFT(1002, "VIP User Gift", TradeType.NON_SECURED_TRANSACTION),

    /**
     * 用户签到赠送
     */
    SIGN_IN_GIFT(1003, "Sign In Gift", TradeType.NON_SECURED_TRANSACTION),


    /**
     * 订阅会员
     */
    SUBSCRIBE_MEMBER(1100, "Subscribe member", TradeType.C2B),

    ;

    private final int value;

    private final String desc;

    private final TradeType tradeType;


    public String getI18nDescWhenSimple() {
        return  MessageUtils.get(this.name());
    }


    BizType(int value, String desc, TradeType tradeType) {
        this.value = value;
        this.desc = desc;
        this.tradeType = tradeType;
    }

    public static BizType get(int value) {
        for (BizType bizType : values()) {
            if (bizType.getValue() == value) {
                return bizType;
            }
        }
        return null;
    }
}
