<?php

declare(strict_types=1);

namespace Apexl\Io\Permissions\Interface;

use Apexl\Io\User\Interfaces\PermissionInterface;

/*
 * Stand-in for the one apexl/io-permissions symbol this package implements.
 * Copied verbatim (signatures only) from io-permissions 2.x, with the namespace
 * carried across the way every io 6 port does it: `apexl\Io\modules\permissions\`
 * becomes `Apexl\Io\Permissions\`, and the package's own directory segment
 * (`Interface`) is preserved.
 *
 * ProductPermission has implemented PermissionFlagInterface since 3.0.0 without
 * io-permissions ever appearing in `require` — it resolved because every host
 * that registers this module also installs io-permissions. That stays true on
 * the io 6 line, except io-permissions has no io 6 release yet, so it cannot be
 * a require-dev either.
 *
 * Loaded by tests/bootstrap.php ONLY, never from composer autoload, so a host
 * that installs this package's dev dependencies can never end up with a fake
 * io-permissions in its container.
 *
 * UNDO, when io-permissions ships on io 6: add it to `require` (dropping the
 * `suggest` entry), delete this file and the `require` line in tests/bootstrap.php,
 * and re-run the suite. If the real release lands on a different name than the
 * one predicted here, this file is where that shows up: the guard stops
 * matching, both declare, and the suite fatals on a duplicate symbol rather than
 * passing quietly against a fiction.
 */

if (!interface_exists(PermissionFlagInterface::class)) {
    interface PermissionFlagInterface extends PermissionInterface
    {
        /** Stable string used for the underlying permission lookup. */
        public function key(): string;

        /** @return list<string> role names that get this flag by default */
        public function defaultRoleNames(): array;
    }
}
