<?php


namespace Mcp\Server;

use Mcp\Schema\Enum\LoggingLevel;
use Mcp\Schema\JsonRpc\Notification;
use Mcp\Schema\Result\CreateSamplingMessageResult;

trait ClientAwareTrait
{
    private ClientGateway $client;

    public function setClient(ClientGateway $client): void
    {
        $this->client = $client;
    }

    private function notify(Notification $notification): void
    {
        $this->client->notify($notification);
    }

    private function log(LoggingLevel $level, mixed $data, ?string $logger = null): void
    {
        $this->client->log($level, $data, $logger);
    }

    private function progress(float $progress, ?float $total = null, ?string $message = null): void
    {
        $this->client->progress($progress, $total, $message);
    }

    private function sample(string $prompt, int $maxTokens = 1000, int $timeout = 120, array $options = []): CreateSamplingMessageResult
    {
        return $this->client->sample($prompt, $maxTokens, $timeout, $options);
    }
}
