package card_info_c_trip

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

	"kami/api/card_info_c_trip/v1"
)

func (c *ControllerV1) RedeemConfigSet(ctx context.Context, req *v1.RedeemConfigSetReq) (res *v1.RedeemConfigSetRes, err error) {
	err = service.SysConfigDict().SetIsAllowRedeemCardDifferentAmount(ctx, consts.CardRedeemAccountCategoryCTrip, req.IsAllowDifferentAmount)
	err = service.SysConfigDict().SetRedeemCardMinAmount(ctx, consts.CardRedeemAccountCategoryCTrip, req.RedeemCardMinAmount)
	err = service.SysConfigDict().SetRedeemCardFailCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryCTrip, req.IsAllowDifferentSucceedCallback)
	err = service.SysConfigDict().SetRedeemCardSucceedCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryCTrip, req.IsAllowDifferentFailCallback)
	err = service.SysConfigDict().SetRedeemCardCompensatedAutoCallback(ctx, consts.CardRedeemAccountCategoryCTrip, req.IsAllowCompensatedCallback)
	service.SysConfigDict().SetRedeemCardRate(ctx, consts.CardRedeemAccountCategoryCTrip, req.RedeemCardRate)
	return
}
