package com.adealink.weparty.module.wallet.data

import com.adealink.frame.aab.util.getCompatString
import com.adealink.frame.base.IError
import com.adealink.weparty.R as APP_R

/**
 * 货币不足
 */
//class CurrencyNotSufficientError :
//    IError(msg = getCompatString(R.string.wallet_gold_coin_not_enough))

/**
 * 渠道充值套餐为空
 */
class RechargeListEmptyError : IError()

/**
 * 从三方查询商品详情失败
 */
class SkuQueryError(code: Int) : IError(serverCode = code) {
    override fun toString(): String {
        return getCompatString(
            APP_R.string.common_sku_query_error, if (msg.isEmpty()) {
                "$serverCode"
            } else {
                "$serverCode,$msg"
            }
        )
    }
}

/**
 * 支付设置失败
 */
class PayChannelSetupError(code: Int) : IError(serverCode = code) {
    override fun toString(): String {
        return getCompatString(
            APP_R.string.common_pay_setup_error, if (msg.isEmpty()) {
                "$serverCode"
            } else {
                "$serverCode,$msg"
            }
        )
    }
}

/**
 * 支付的失败
 */
class PayError(code: Int, msg: String = "") : IError(serverCode = code, msg = msg) {
    override fun toString(): String {
        return getCompatString(
            APP_R.string.common_pay_error, if (msg.isEmpty()) {
                "$serverCode"
            } else {
                "$serverCode,$msg"
            }
        )
    }
}

/**
 * 渠道未知
 */
class PayChannelUnKnowError :
    IError(msg = getCompatString(APP_R.string.common_pay_channel_unknown_error)) {
    override fun toString(): String {
        return getCompatString(APP_R.string.common_pay_channel_unknown_error)
    }
}
