package card_info_c_trip

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

	"kami/api/card_info_c_trip/v1"
)

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