<?php

declare(strict_types=1);

namespace Blax\WebRtc\Contracts;

/**
 * Authorizes a join to a `private-*` or `presence-*` room. The host app binds its
 * own implementation (checking a signed token, the authenticated user, room
 * membership, ...). Public + open-presence rooms never reach the authorizer.
 */
interface RoomAuthorizer
{
    /**
     * @param  array<string,mixed>  $auth  client-supplied auth payload (token, etc.)
     * @return array<string,mixed>|null presence info to publish if allowed; null denies the join
     */
    public function authorize(string $peerId, string $roomId, array $auth): ?array;
}
