<?php

declare(strict_types=1);

namespace Apexl\Io\Routing;

use Psr\Http\Server\MiddlewareInterface;

/**
 * Middleware that both enforces a permission and will say what it is.
 *
 * io has no notion of a permission — that is io-user's — but it does need to ask a route what
 * gates it, for `routes:dump`. This is the contract that lets it ask without depending on the
 * package that answers: io-user's RoutePermissionMiddleware implements it, and anything else
 * that gates a route can too.
 */
interface DeclaresRoutePermission extends MiddlewareInterface
{
    /**
     * Whatever the implementing package uses to describe a permission — one, or several.
     *
     * @return object|object[]
     */
    public function getPermission(): object|array;
}
