package card_info_c_trip

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

	"kami/api/card_info_c_trip/v1"
)

func (c *ControllerV1) AccountUpdateStatus(ctx context.Context, req *v1.AccountUpdateStatusReq) (res *v1.AccountUpdateStatusRes, err error) {
	accountService := service.CardRedeemAccount()
	err = accountService.UpdateStatus(ctx, req.ID, req.Status, nil)
	if err == nil && req.Status == consts.RedeemAccountNormal {
		_ = service.CardRedeemOrder().TriggerValidateAndConsume()
	}
	return
}
