<?php

declare(strict_types=1);

namespace App\SuperAdmin\Infrastructure\Security;

use App\SuperAdmin\Domain\Model\SuperAdmin\SuperAdminId;
use Override;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;

final readonly class SecuritySuperAdmin implements UserInterface, PasswordAuthenticatedUserInterface
{
    /** @var non-empty-string */
    private string $email;

    /**
     * @param non-empty-string $email
     */
    public function __construct(
        private SuperAdminId $superAdminId,
        string $email,
        private string $hashedPassword,
    ) {
        $this->email = $email;
    }

    #[Override]
    public function getUserIdentifier(): string
    {
        return $this->email;
    }

    public function superAdminId(): string
    {
        return (string) $this->superAdminId;
    }

    #[Override]
    public function getPassword(): string
    {
        return $this->hashedPassword;
    }

    /**
     * @return list<string>
     */
    #[Override]
    public function getRoles(): array
    {
        return ['ROLE_SUPER_ADMIN'];
    }

    public function eraseCredentials(): void
    {
    }
}
