package client

import (
	"context"

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

// AchievementClient abstracts App achievement and badge reads from activity-service.
type AchievementClient interface {
	ListAchievements(ctx context.Context, req *activityv1.ListAchievementsRequest) (*activityv1.ListAchievementsResponse, error)
	ListMyBadges(ctx context.Context, req *activityv1.ListMyBadgesRequest) (*activityv1.ListMyBadgesResponse, error)
	SetBadgeDisplay(ctx context.Context, req *activityv1.SetBadgeDisplayRequest) (*activityv1.SetBadgeDisplayResponse, error)
}

type grpcAchievementClient struct {
	client activityv1.AchievementServiceClient
}

func NewGRPCAchievementClient(conn *grpc.ClientConn) AchievementClient {
	return &grpcAchievementClient{client: activityv1.NewAchievementServiceClient(conn)}
}

func (c *grpcAchievementClient) ListAchievements(ctx context.Context, req *activityv1.ListAchievementsRequest) (*activityv1.ListAchievementsResponse, error) {
	return c.client.ListAchievements(ctx, req)
}

func (c *grpcAchievementClient) ListMyBadges(ctx context.Context, req *activityv1.ListMyBadgesRequest) (*activityv1.ListMyBadgesResponse, error) {
	return c.client.ListMyBadges(ctx, req)
}

func (c *grpcAchievementClient) SetBadgeDisplay(ctx context.Context, req *activityv1.SetBadgeDisplayRequest) (*activityv1.SetBadgeDisplayResponse, error) {
	return c.client.SetBadgeDisplay(ctx, req)
}
