package redeem

import (
	"kami/internal/consts"
	"kami/utility/integration/redeem"
	redeemCTrip "kami/utility/integration/redeem/ctrip"
	redeemJD "kami/utility/integration/redeem/jd"
	redeemWalmart "kami/utility/integration/redeem/walmart"

	"github.com/gogf/gf/v2/errors/gerror"
)

var clientMapper = map[consts.CardRedeemAccountCategory]redeem.Client{
	consts.CardRedeemAccountCategoryJD:      &redeemJD.Client{},
	consts.CardRedeemAccountCategoryWalMart: &redeemWalmart.Client{},
	consts.CardRedeemAccountCategoryCTrip:   &redeemCTrip.Client{},
}

func GetClient(channel consts.CardRedeemAccountCategory) (redeem.Client, error) {
	client, ok := clientMapper[channel]
	if !ok {
		return nil, gerror.New("获取客户端失败")
	}
	return client, nil
}
