package client

import (
	"context"

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

// WeeklyStarClient abstracts gateway access to activity-service weekly-star APIs.
type WeeklyStarClient interface {
	GetWeeklyStarCurrent(ctx context.Context, req *activityv1.GetWeeklyStarCurrentRequest) (*activityv1.GetWeeklyStarCurrentResponse, error)
	ListWeeklyStarLeaderboard(ctx context.Context, req *activityv1.ListWeeklyStarLeaderboardRequest) (*activityv1.ListWeeklyStarLeaderboardResponse, error)
	ListWeeklyStarHistory(ctx context.Context, req *activityv1.ListWeeklyStarHistoryRequest) (*activityv1.ListWeeklyStarHistoryResponse, error)
}

type grpcWeeklyStarClient struct {
	client activityv1.WeeklyStarServiceClient
}

func NewGRPCWeeklyStarClient(conn *grpc.ClientConn) WeeklyStarClient {
	return &grpcWeeklyStarClient{client: activityv1.NewWeeklyStarServiceClient(conn)}
}

func (c *grpcWeeklyStarClient) GetWeeklyStarCurrent(ctx context.Context, req *activityv1.GetWeeklyStarCurrentRequest) (*activityv1.GetWeeklyStarCurrentResponse, error) {
	return c.client.GetWeeklyStarCurrent(ctx, req)
}

func (c *grpcWeeklyStarClient) ListWeeklyStarLeaderboard(ctx context.Context, req *activityv1.ListWeeklyStarLeaderboardRequest) (*activityv1.ListWeeklyStarLeaderboardResponse, error) {
	return c.client.ListWeeklyStarLeaderboard(ctx, req)
}

func (c *grpcWeeklyStarClient) ListWeeklyStarHistory(ctx context.Context, req *activityv1.ListWeeklyStarHistoryRequest) (*activityv1.ListWeeklyStarHistoryResponse, error) {
	return c.client.ListWeeklyStarHistory(ctx, req)
}
