package client

import (
	"context"

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

// AgencyOpeningClient abstracts H5 agency opening activity calls to activity-service.
type AgencyOpeningClient interface {
	GetAgencyOpeningStatus(ctx context.Context, req *activityv1.GetAgencyOpeningStatusRequest) (*activityv1.GetAgencyOpeningStatusResponse, error)
	ApplyAgencyOpening(ctx context.Context, req *activityv1.ApplyAgencyOpeningRequest) (*activityv1.ApplyAgencyOpeningResponse, error)
	ListAgencyOpeningLeaderboard(ctx context.Context, req *activityv1.ListAgencyOpeningApplicationsRequest) (*activityv1.ListAgencyOpeningApplicationsResponse, error)
}

type grpcAgencyOpeningClient struct {
	client activityv1.AgencyOpeningServiceClient
}

func NewGRPCAgencyOpeningClient(conn *grpc.ClientConn) AgencyOpeningClient {
	return &grpcAgencyOpeningClient{client: activityv1.NewAgencyOpeningServiceClient(conn)}
}

func (c *grpcAgencyOpeningClient) GetAgencyOpeningStatus(ctx context.Context, req *activityv1.GetAgencyOpeningStatusRequest) (*activityv1.GetAgencyOpeningStatusResponse, error) {
	return c.client.GetAgencyOpeningStatus(ctx, req)
}

func (c *grpcAgencyOpeningClient) ApplyAgencyOpening(ctx context.Context, req *activityv1.ApplyAgencyOpeningRequest) (*activityv1.ApplyAgencyOpeningResponse, error) {
	return c.client.ApplyAgencyOpening(ctx, req)
}

func (c *grpcAgencyOpeningClient) ListAgencyOpeningLeaderboard(ctx context.Context, req *activityv1.ListAgencyOpeningApplicationsRequest) (*activityv1.ListAgencyOpeningApplicationsResponse, error) {
	return c.client.ListAgencyOpeningLeaderboard(ctx, req)
}
