package walmart

import "kami/internal/consts"

type BalanceResp struct {
	Data struct {
		Balance float64 `json:"balance"`
	} `json:"data,omitempty"`
	Code int `json:"code"`
}

type QueryCardResp struct {
	Code int `json:"code"`
	Data struct {
		Money string `json:"money"`
	} `json:"data"`
	Msg string `json:"msg"`
}

type BindCardType int64

func (r BindCardType) Status() consts.RedeemOrderStatus {
	switch r {
	case BindCardSucceed:
		return consts.RedeemOrderSuccess
	case BindCardCkFail:
		return consts.RedeemOrderFailWithCKFail
	case BindCardOtherBind:
		return consts.RedeemOrderFailWithOtherBind
	case BindCardTooMuch:
		return consts.RedeemOrderFailWithFrequent
	case BindCardFailWithWrongCode:
		return consts.RedeemOrderFailRuleError
	case BindCardFailWithRepeat:
		return consts.RedeemOrderFailWithRepeat
	case BindCardFailWithDailyBindLimit:
		return consts.RedeemOrderFailWithDailyAccountLimited
	case BindCardFailWithUnknown:
		return consts.RedeemOrderFailWithCardUnknown
	case BindCardFailWithCardNotExist:
		return consts.RedeemOrderFailCardNotExist
	}
	// FIXME: 暂时未知的错误，按照ck错误处理
	return consts.RedeemOrderFailWithCKFail
	// return consts.RedeemOrderFailWithCardUnknown
}

const (
	BindCardSucceed                BindCardType = 1000
	BindCardCkFail                 BindCardType = 1013
	BindCardOtherBind              BindCardType = 1004
	BindCardTooMuch                BindCardType = 1015
	BindCardFailWithWrongCode      BindCardType = 1005
	BindCardFailWithCardNotExist   BindCardType = 1006
	BindCardFailWithRepeat         BindCardType = 1100
	BindCardFailWithDailyBindLimit BindCardType = 1016
	BindCardFailWithUnknown        BindCardType = 1110
)

type BindCardResp struct {
	Code    BindCardType `json:"code"`
	LogList []string     `json:"log_list"`
	Record  string       `json:"record"`
	Remarks string       `json:"remarks"`
}
