package consts

type CardRedeemAccountCategory string

const (
	CardRedeemAccountCategoryWalMart    CardRedeemAccountCategory = "walmart"
	CardRedeemAccountCategoryJD         CardRedeemAccountCategory = "jd"
	CardRedeemAccountCategoryApple      CardRedeemAccountCategory = "apple"
	CardRedeemAccountCategoryOriginalJD CardRedeemAccountCategory = "originalJD"
	CardRedeemAccountCategoryCTrip      CardRedeemAccountCategory = "cTrip"
	CardRedeemAccountCategoryCamelOil   CardRedeemAccountCategory = "camelOil"
)

func (c CardRedeemAccountCategory) Name() string {
	switch c {
	case CardRedeemAccountCategoryJD:
		return "京东"
	case CardRedeemAccountCategoryWalMart:
		return "沃尔玛"
	case CardRedeemAccountCategoryApple:
		return "苹果"
	case CardRedeemAccountCategoryCTrip:
		return "携程"
	case CardRedeemAccountCategoryCamelOil:
		return "骆驼加油"
	case CardRedeemAccountCategoryOriginalJD:
		return "京东"
	default:
		return "未知错误"
	}
}

func (c CardRedeemAccountCategory) String() string {
	return string(c)
}

var ChannelTypeList = []CardRedeemAccountCategory{
	CardRedeemAccountCategoryJD,
	CardRedeemAccountCategoryWalMart,
	CardRedeemAccountCategoryCTrip,
	CardRedeemAccountCategoryApple,
	CardRedeemAccountCategoryOriginalJD,
	CardRedeemAccountCategoryCamelOil,
}

type RedeemAccountStatus int32

const (
	RedeemAccountForbidden                  RedeemAccountStatus = iota // 账号禁用
	RedeemAccountNormal                                                // 账号正常
	RedeemAccountForbiddenByTooFast                                    // 账号充值速度过快
	RedeemAccountForbiddenByMaxLimit                                   // 账号禁用，最大充值金额
	RedeemAccountLimited                                               // 账号受到限制
	RedeemAccountForbiddenByLowRecharge                                // 由于低于50元以下充值导致
	RedeemAccountForbiddenBySafetyReason                               // 账号安全原因
	RedeemAccountTmpStoppedByTooManyRequest                            // 账号临时暂停兑换，10分钟后恢复
	RedeemAccountForbiddenDaily                                        // 账户每日禁用
)

func (j RedeemAccountStatus) GetStatusText() string {
	switch j {
	case RedeemAccountForbidden:
		return "账号禁用"
	case RedeemAccountNormal:
		return "账号正常"
	case RedeemAccountForbiddenByTooFast:
		return "账号充值速度过快"
	case RedeemAccountForbiddenByMaxLimit:
		return "账号禁用，最大充值金额"
	case RedeemAccountLimited:
		return "账号受到限制"
	case RedeemAccountForbiddenByLowRecharge:
		return "由于低于50以下充值导致"
	case RedeemAccountForbiddenBySafetyReason:
		return "账号安全原因"
	case RedeemAccountTmpStoppedByTooManyRequest:
		return "账号临时暂停兑换，10分钟后恢复"
	default:
		return "未知错误"
	}
}

type RedeemAccountUsedStatus bool

const (
	RedeemAccountUsedStatusEnable  RedeemAccountUsedStatus = true
	RedeemAccountUsedStatusDisable RedeemAccountUsedStatus = false
)

type RedeemAccountOperationStatus string

const (
	RedeemAccountOperationDeduct     RedeemAccountOperationStatus = "deduct"     // 减款
	RedeemAccountOperationAdd        RedeemAccountOperationStatus = "add"        // 加款
	RedeemAccountOperationInitialize RedeemAccountOperationStatus = "initialize" // 初始化
	RedeemAccountOperationReturn     RedeemAccountOperationStatus = "return"     // 退款
	RedeemAccountOperationPreDeduct  RedeemAccountOperationStatus = "pre_deduct" // 预扣款
	RedeemAccountOperationPreAdd     RedeemAccountOperationStatus = "pre_add"    // 预加款
)

// RedeemOrderStatus 充值编码
type RedeemOrderStatus int

const (
	RedeemOrderStart                       RedeemOrderStatus = 18  // 开始处理
	RedeemOrderProcessing                  RedeemOrderStatus = 14  // 开始处理
	RedeemOrderFail                        RedeemOrderStatus = 100 // 充值失败
	RedeemOrderSuccess                     RedeemOrderStatus = 1   // 充值成功
	RedeemOrderPending                     RedeemOrderStatus = 2   // 待处理
	RedeemOrderRefundWithValidatedFail     RedeemOrderStatus = 3   // 验证失败（账号相关）
	RedeemOrderFailWithCKFail              RedeemOrderStatus = 4   // 账号失效（账号相关）
	RedeemOrderFailWithFrequent            RedeemOrderStatus = 5   // 账号频繁
	RedeemOrderFailWithCardUnknown         RedeemOrderStatus = 6   // 未知状态
	RedeemOrderForbiddenByMaxLimit         RedeemOrderStatus = 7   // 订单禁用，最大调用次数
	RedeemOrderSuccessWithDifferentAmount  RedeemOrderStatus = 8   // 充值金额与订单金额不一致（已经充值）
	RedeemOrderFailWithWrongCardType       RedeemOrderStatus = 9   // 卡密类型错误
	RedeemOrderFailWithDifferentAmount     RedeemOrderStatus = 10  // 充值金额与订单金额不一致（没有充值）
	RedeemOrderFailWithOtherBind           RedeemOrderStatus = 11  // 卡密被绑定
	RedeemOrderFailWithRepeat              RedeemOrderStatus = 12  // 重复绑卡
	RedeemOrderFailWithDailyAccountLimited RedeemOrderStatus = 13  // 账号受到限制
	RedeemOrderFailCardNotExist            RedeemOrderStatus = 15  // 卡片无效/不存在
	RedeemOrderFailWithCardOverDue         RedeemOrderStatus = 16  // 卡片过期
	RedeemOrderSuccessWithCompensated      RedeemOrderStatus = 17  // 补卡成功
	RedeemOrderFailRepeated                RedeemOrderStatus = 19  // 重复订单
	RedeemOrderFailRuleError               RedeemOrderStatus = 20  // 卡号不符合规则
	RedeemOrderFailWithFrozen              RedeemOrderStatus = 21  // 卡密冻结
)

func (r *RedeemOrderStatus) String() string {
	switch *r {
	case RedeemOrderStart:
		return "开始处理"
	case RedeemOrderProcessing:
		return "处理中"
	case RedeemOrderFail:
		return "充值失败"
	case RedeemOrderSuccess:
		return "充值成功"
	case RedeemOrderPending:
		return "待处理"
	case RedeemOrderRefundWithValidatedFail:
		return "验证失败（账号相关）"
	case RedeemOrderFailWithCKFail:
		return "账号失效（账号相关）"
	case RedeemOrderFailWithFrequent:
		return "账号频繁"
	case RedeemOrderFailWithCardUnknown:
		return "未知状态"
	case RedeemOrderForbiddenByMaxLimit:
		return "订单禁用，最大调用次数"
	case RedeemOrderSuccessWithDifferentAmount:
		return "充值金额与订单金额不一致（已经充值）"
	case RedeemOrderFailWithWrongCardType:
		return "卡密类型错误"
	case RedeemOrderFailWithDifferentAmount:
		return "充值金额与订单金额不一致（没有充值）"
	case RedeemOrderFailWithOtherBind:
		return "卡密被绑定"
	case RedeemOrderFailWithRepeat:
		return "重复绑卡"
	case RedeemOrderFailWithDailyAccountLimited:
		return "账号受到限制"
	case RedeemOrderFailCardNotExist:
		return "卡片无效/不存在"
	case RedeemOrderFailWithCardOverDue:
		return "卡片过期"
	case RedeemOrderSuccessWithCompensated:
		return "补卡成功"
	case RedeemOrderFailRepeated:
		return "重复订单"
	case RedeemOrderFailRuleError:
		return "卡号不符合规则"
	case RedeemOrderFailWithFrozen:
		return "卡密冻结"
	default:
		return "未知错误"
	}
}

type RedeemOrderOperationStatus int

const (
	RedeemOrderOperationFail                          RedeemOrderOperationStatus = 100 // 充值失败
	RedeemOrderOperationAdd                           RedeemOrderOperationStatus = 1   // 新增订单
	RedeemOrderOperationPending                       RedeemOrderOperationStatus = 2   // 待处理
	RedeemOrderOperationSuccess                       RedeemOrderOperationStatus = 3   // 充值成功
	RedeemOrderOperationCallback                      RedeemOrderOperationStatus = 4   // 开始回调
	RedeemOrderOperationRefund                        RedeemOrderOperationStatus = 5   // 订单退回
	RedeemOrderOperationFailWithCookie                RedeemOrderOperationStatus = 6   // 订单失败，账号问题
	RedeemOrderOperationPendingFail                   RedeemOrderOperationStatus = 7   // 分配账号失败
	RedeemOrderOperationFailWithValidatedFail         RedeemOrderOperationStatus = 8   // 验证失败
	RedeemOrderOperationCallbackStart                 RedeemOrderOperationStatus = 9   // 开始回调
	RedeemOrderOperationCallbackSucceed               RedeemOrderOperationStatus = 10  // 回调成功
	RedeemOrderOperationCallbackFailed                RedeemOrderOperationStatus = 11  // 回调失败
	RedeemOrderOperationCallbackFailedWithWrongStatus RedeemOrderOperationStatus = 12  // 回调失败，状态错误
	RedeemOrderOperationCallbackNotExecuteWithUserCfg RedeemOrderOperationStatus = 13  // 用户设置回调，不触发回调
	RedeemOrderOperationUnknown                       RedeemOrderOperationStatus = 14  // 未知状态
	RedeemOrderOperationFailWithServerError           RedeemOrderOperationStatus = 15  // 服务器错误
	RedeemOrderOperationStart                         RedeemOrderOperationStatus = 16  // 开始处理订单
	RedeemOrderOperationQueryCardAmount               RedeemOrderOperationStatus = 17  // 查询卡密余额
	RedeemOrderOperationStartBind                     RedeemOrderOperationStatus = 18  // 开始绑卡
	RedeemOrderOperationEndBind                       RedeemOrderOperationStatus = 19  // 结束绑卡
)

func (r *RedeemOrderOperationStatus) String() string {
	switch *r {
	case RedeemOrderOperationFail:
		return "充值失败"
	case RedeemOrderOperationAdd:
		return "新增订单"
	case RedeemOrderOperationPending:
		return "待处理"
	case RedeemOrderOperationSuccess:
		return "充值成功"
	case RedeemOrderOperationCallback:
		return "开始回调"
	case RedeemOrderOperationRefund:
		return "订单退回"
	case RedeemOrderOperationFailWithCookie:
		return "订单失败，账号问题"
	case RedeemOrderOperationPendingFail:
		return "分配账号失败"
	case RedeemOrderOperationFailWithValidatedFail:
		return "验证失败"
	case RedeemOrderOperationCallbackStart:
		return "开始回调"
	case RedeemOrderOperationCallbackSucceed:
		return "回调成功"
	case RedeemOrderOperationCallbackFailed:
		return "回调失败"
	case RedeemOrderOperationCallbackFailedWithWrongStatus:
		return "回调失败，状态错误"
	case RedeemOrderOperationCallbackNotExecuteWithUserCfg:
		return "用户设置回调，不触发回调"
	case RedeemOrderOperationFailWithServerError:
		return "服务器错误"
	case RedeemOrderOperationStart:
		return "开始处理订单"
	case RedeemOrderOperationUnknown:
		return "未知状态"
	default:
		return "未知状态"
	}
}

// RedeemOrderCallbackStatus 订单回调状态
type RedeemOrderCallbackStatus int

const (
	RedeemOrderCallbackStatusSuccess RedeemOrderCallbackStatus = 1
	RedeemOrderCallbackStatusFail    RedeemOrderCallbackStatus = 2
)

type RedeemOrderCardCategory string

const (
	RedeemOrderCardCategoryApple   RedeemOrderCardCategory = "apple"
	RedeemOrderCardCategoryCTrip   RedeemOrderCardCategory = "cTrip"
	RedeemOrderCardCategoryWalmart RedeemOrderCardCategory = "walmart"
)
