package walmart

import "kami/internal/consts"

type BalanceResp struct {
	Error struct {
		Errorcode  int         `json:"errorcode"`
		Message    string      `json:"message"`
		Redirect   interface{} `json:"redirect"`
		Validators interface{} `json:"validators"`
	} `json:"error"`
	Data struct {
		Balance string `json:"balance"`
	} `json:"data,omitempty"`
	Status bool `json:"status"`
}

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.RedeemOrderFailWithCKFail
	//case BindCardFailWithRepeat:
	//	return consts.RedeemOrderFailWithRepeat
	//case BindCardFailWithDailyBindLimit:
	//	return consts.RedeemOrderFailWithDailyAccountLimited
	case BindCardFailWithUnknown:
		return consts.RedeemOrderFailWithCardUnknown
	case BindCardFailWithCardNotExist:
		return consts.RedeemOrderFailCardNotExist
	case BindCardFailWithWrongAmount:
		return consts.RedeemOrderFailWithDifferentAmount
	}
	return consts.RedeemOrderFailWithCardUnknown
}

const (
	BindCardSucceed              BindCardType = 100
	BindCardCkFail               BindCardType = 113 // ck检测不通过
	BindCardOtherBind            BindCardType = 104
	BindCardFailWithUnknown      BindCardType = 110
	BindCardTooMuch              BindCardType = 115
	BindCardFailWithCardNotExist BindCardType = 105
	BindCardFailWithWrongAmount  BindCardType = 114
	//BindCardFailWithWrongCode    BindCardType = 1005
)

type BindCardResp struct {
	Code BindCardType `json:"code"`
	Msg  string       `json:"msg"`
	Data string       `json:"data"`
}
