<?php

declare(strict_types=1);

namespace App\Administration\Application\Port;

use App\Administration\Domain\Model\User\Role;
use App\Administration\Domain\Model\User\User;

/**
 * Port interface for storing the user's currently active role.
 *
 * When a user has multiple roles (FR5), they can switch between them.
 * This store persists the selected role across requests.
 */
interface ActiveRoleStore
{
    /**
     * Stores the active role for the given user.
     */
    public function store(User $user, Role $role): void;

    /**
     * Returns the stored active role for the given user, or null if none.
     */
    public function get(User $user): ?Role;

    /**
     * Clears the stored active role for the given user (e.g. at logout).
     */
    public function clear(User $user): void;
}
