package client

import (
	"context"

	"google.golang.org/grpc"
	activityv1 "hyapp.local/api/proto/activity/v1"
)

// InviteActivityRewardClient abstracts gateway reads and claims from activity-service invite reward APIs.
type InviteActivityRewardClient interface {
	GetInviteActivityRewardStatus(ctx context.Context, req *activityv1.GetInviteActivityRewardStatusRequest) (*activityv1.GetInviteActivityRewardStatusResponse, error)
	ClaimInviteActivityReward(ctx context.Context, req *activityv1.ClaimInviteActivityRewardRequest) (*activityv1.ClaimInviteActivityRewardResponse, error)
	ListInviteActivityLeaderboard(ctx context.Context, req *activityv1.ListInviteActivityLeaderboardRequest) (*activityv1.ListInviteActivityLeaderboardResponse, error)
}

// InviteActivityInviteeClient 单独描述新邀请明细能力，避免滚动升级期间扩大旧 client/fake 的强制实现面。
type InviteActivityInviteeClient interface {
	ListInviteActivityInvitees(ctx context.Context, req *activityv1.ListInviteActivityInviteesRequest) (*activityv1.ListInviteActivityInviteesResponse, error)
}

type grpcInviteActivityRewardClient struct {
	client activityv1.InviteActivityRewardServiceClient
}

func NewGRPCInviteActivityRewardClient(conn *grpc.ClientConn) InviteActivityRewardClient {
	return &grpcInviteActivityRewardClient{client: activityv1.NewInviteActivityRewardServiceClient(conn)}
}

func (c *grpcInviteActivityRewardClient) GetInviteActivityRewardStatus(ctx context.Context, req *activityv1.GetInviteActivityRewardStatusRequest) (*activityv1.GetInviteActivityRewardStatusResponse, error) {
	return c.client.GetInviteActivityRewardStatus(ctx, req)
}

func (c *grpcInviteActivityRewardClient) ClaimInviteActivityReward(ctx context.Context, req *activityv1.ClaimInviteActivityRewardRequest) (*activityv1.ClaimInviteActivityRewardResponse, error) {
	return c.client.ClaimInviteActivityReward(ctx, req)
}

func (c *grpcInviteActivityRewardClient) ListInviteActivityLeaderboard(ctx context.Context, req *activityv1.ListInviteActivityLeaderboardRequest) (*activityv1.ListInviteActivityLeaderboardResponse, error) {
	return c.client.ListInviteActivityLeaderboard(ctx, req)
}

func (c *grpcInviteActivityRewardClient) ListInviteActivityInvitees(ctx context.Context, req *activityv1.ListInviteActivityInviteesRequest) (*activityv1.ListInviteActivityInviteesResponse, error) {
	return c.client.ListInviteActivityInvitees(ctx, req)
}
