package client

import (
	"context"

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

// GrowthLevelClient abstracts App level reads from activity-service.
type GrowthLevelClient interface {
	GetMyLevelOverview(ctx context.Context, req *activityv1.GetMyLevelOverviewRequest) (*activityv1.GetMyLevelOverviewResponse, error)
	GetLevelTrack(ctx context.Context, req *activityv1.GetLevelTrackRequest) (*activityv1.GetLevelTrackResponse, error)
	BatchGetUserLevelDisplayProfiles(ctx context.Context, req *activityv1.BatchGetUserLevelDisplayProfilesRequest) (*activityv1.BatchGetUserLevelDisplayProfilesResponse, error)
	ListLevelRewards(ctx context.Context, req *activityv1.ListLevelRewardsRequest) (*activityv1.ListLevelRewardsResponse, error)
	SetUserLevel(ctx context.Context, req *activityv1.SetUserLevelRequest) (*activityv1.SetUserLevelResponse, error)
}

type grpcGrowthLevelClient struct {
	client activityv1.GrowthLevelServiceClient
}

func NewGRPCGrowthLevelClient(conn *grpc.ClientConn) GrowthLevelClient {
	return &grpcGrowthLevelClient{client: activityv1.NewGrowthLevelServiceClient(conn)}
}

func (c *grpcGrowthLevelClient) GetMyLevelOverview(ctx context.Context, req *activityv1.GetMyLevelOverviewRequest) (*activityv1.GetMyLevelOverviewResponse, error) {
	return c.client.GetMyLevelOverview(ctx, req)
}

func (c *grpcGrowthLevelClient) GetLevelTrack(ctx context.Context, req *activityv1.GetLevelTrackRequest) (*activityv1.GetLevelTrackResponse, error) {
	return c.client.GetLevelTrack(ctx, req)
}

func (c *grpcGrowthLevelClient) BatchGetUserLevelDisplayProfiles(ctx context.Context, req *activityv1.BatchGetUserLevelDisplayProfilesRequest) (*activityv1.BatchGetUserLevelDisplayProfilesResponse, error) {
	return c.client.BatchGetUserLevelDisplayProfiles(ctx, req)
}

func (c *grpcGrowthLevelClient) ListLevelRewards(ctx context.Context, req *activityv1.ListLevelRewardsRequest) (*activityv1.ListLevelRewardsResponse, error) {
	return c.client.ListLevelRewards(ctx, req)
}

func (c *grpcGrowthLevelClient) SetUserLevel(ctx context.Context, req *activityv1.SetUserLevelRequest) (*activityv1.SetUserLevelResponse, error) {
	return c.client.SetUserLevel(ctx, req)
}
