<?php

declare(strict_types=1);

namespace Plugin\tnt_mcp\src\Mcp\OAuth\Entities;

use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Entities\Traits\ClientTrait;
use League\OAuth2\Server\Entities\Traits\EntityTrait;

/**
 * A registered OAuth client (one per MCP connector). Public by default (PKCE, no secret) — the
 * dynamic-registration flow the ChatGPT/Claude connectors use registers exactly this shape.
 */
final class ClientEntity implements ClientEntityInterface
{
    use EntityTrait;
    use ClientTrait;

    /**
     * @param non-empty-string $identifier opaque client_id
     * @param string       $name         human label
     * @param list<string> $redirectUris allow-listed redirect URIs
     * @param bool         $isConfidential true when a client secret was issued
     */
    public function __construct(
        string $identifier,
        string $name,
        array $redirectUris,
        bool $isConfidential,
    ) {
        $this->setIdentifier($identifier);
        $this->name           = $name;
        $this->redirectUri    = $redirectUris;
        $this->isConfidential = $isConfidential;
    }
}
