package card_info_walmart

import (
	"context"
	"kami/internal/consts"
	"kami/internal/service"

	v1 "kami/api/card_info_walmart/v1"
)

func (c *ControllerV1) RedeemConfigGet(ctx context.Context, req *v1.RedeemConfigGetReq) (res *v1.RedeemConfigGetRes, err error) {
	res = &v1.RedeemConfigGetRes{}
	res.IsAllowDifferentAmount, _ = service.SysConfigDict().GetIsAllowRedeemCardDifferentAmount(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.RedeemCardMinAmount = service.SysConfigDict().GetRedeemCardMinAmount(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowDifferentSucceedCallback = service.SysConfigDict().GetRedeemCardSucceedCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowDifferentFailCallback = service.SysConfigDict().GetRedeemCardFailCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowCompensatedCallback = service.SysConfigDict().GetRedeemCardCompensatedAutoCallback(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.RedeemCardRate = service.SysConfigDict().GetRedeemCardRate(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsCardAllowRepeated = service.SysConfigDict().GetIsAllowedRepeated(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.MaxAccountRedeemCount = service.SysConfigDict().GetMaxAccountRedeemCount(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.RedeemOrderScheduleStrategy, _ = service.SysConfigDict().GetRedeemScheduleStrategy(ctx, consts.CardRedeemAccountCategoryWalMart, nil)
	return
}
