<?php

declare(strict_types=1);

namespace Facile\OpenIDClient\Session;

use JsonSerializable;
use Override;

/**
 * @psalm-api
 *
 * @psalm-type AuthSessionType = array{state?: string, nonce?: string, code_verifier?: string, customs?: array<string, mixed>}
 */
interface AuthSessionInterface extends JsonSerializable
{
    public function getState(): ?string;

    public function getNonce(): ?string;

    public function getCodeVerifier(): ?string;

    /**
     * @return array<string, mixed>
     */
    public function getCustoms(): array;

    public function setState(?string $state): void;

    public function setNonce(?string $nonce): void;

    public function setCodeVerifier(?string $codeVerifier): void;

    /**
     * @param array<string, mixed> $customs
     */
    public function setCustoms(array $customs): void;

    /**
     * @param array<string, mixed> $array
     *
     * @psalm-param AuthSessionType $array
     *
     * @return static
     */
    public static function fromArray(array $array): self;

    /**
     * @return array<string, mixed>
     *
     * @psalm-return AuthSessionType
     */
    #[Override]
    public function jsonSerialize(): array;
}
