package card_info_jd

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

	"kami/api/card_info_jd/v1"
)

func (c *ControllerV1) JDConfigGet(ctx context.Context, req *v1.JDConfigGetReq) (res *v1.JDConfigGetRes, err error) {
	res = &v1.JDConfigGetRes{}
	isAllow, _ := service.SysConfigDict().GetIsAllowRedeemCardDifferentAmount(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowDifferentAmount = isAllow
	amount := service.SysConfigDict().GetRedeemCardMinAmount(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.RedeemCardMinAmount = amount
	isAllow = service.SysConfigDict().GetRedeemCardSucceedCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowDifferentSucceedCallback = isAllow
	isAllow = service.SysConfigDict().GetRedeemCardFailCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowDifferentFailCallback = isAllow
	isAllow = service.SysConfigDict().GetRedeemCardCompensatedAutoCallback(ctx, consts.CardRedeemAccountCategoryWalMart)
	res.IsAllowCompensatedCallback = isAllow
	res.RedeemCardRate = service.SysConfigDict().GetRedeemCardRate(ctx, consts.CardRedeemAccountCategoryWalMart)
	return
}
