<?php

declare(strict_types=1);

namespace Jose\Component\Core;

use Countable;
use InvalidArgumentException;
use IteratorAggregate;
use JsonSerializable;
use Facile\JoseVerifier\Psalm\PsalmTypes;

/**
 * @implements IteratorAggregate<mixed, JWK>
 */
class JWKSet implements Countable, IteratorAggregate, JsonSerializable
{
    /**
     * @psalm-param array{keys: list<array<string, mixed>>} $data
     * @return static
     */
    public static function createFromKeyData(array $data): self
    {}

    public static function createFromJson(string $json): self
    {}

    /**
     * @return JWK[]
     */
    public function all(): array
    {}

    public function with(JWK $jwk): self
    {}

    /**
     * @param int|string $key
     * @return static
     */
    public function without($key): self
    {}

    /**
     * @param int|string $index
     * @return bool
     */
    public function has($index): bool
    {}

    /**
     * @param int|string $index
     * @return JWK
     *
     * @throws InvalidArgumentException
     */
    public function get($index): JWK
    {}

    /**
     * Try to find a key that fits on the selected requirements. Returns null if not found.
     *
     * @param string $type Must be 'sig' (signature) or 'enc' (encryption)
     * @param Algorithm|null $algorithm Specifies the algorithm to be used
     * @param array<string, mixed> $restrictions More restrictions such as 'kid' or 'kty'
     */
    public function selectKey(string $type, ?Algorithm $algorithm = null, array $restrictions = []): ?JWK
    {}

    /**
     * @return array{keys: list<array<string, mixed>>}
     */
    public function jsonSerialize(): array
    {}
}
