package client

import (
	"context"

	servicecontract "core/shared/apicontract"
	"core/shared/serverapi"
)

type SessionViewClient interface {
	GetSessionMainView(ctx context.Context, req serverapi.SessionMainViewRequest) (serverapi.SessionMainViewResponse, error)
}

type loopbackSessionViewClient struct {
	loopbackClient[servicecontract.SessionViewService]
}

func NewLoopbackSessionViewClient(service servicecontract.SessionViewService) SessionViewClient {
	return &loopbackSessionViewClient{loopbackClient: newLoopbackClient(service)}
}

func (c *loopbackSessionViewClient) GetSessionMainView(ctx context.Context, req serverapi.SessionMainViewRequest) (serverapi.SessionMainViewResponse, error) {
	return callLoopbackClient(c, "session view service is required", ctx, req, servicecontract.SessionViewService.GetSessionMainView)
}
