<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CmsBundle\Message;

use Ferienpass\CoreBundle\Entity\User;
use Ferienpass\CoreBundle\Message\LoggableMessageInterface;

class LoginLinkRequested implements LoggableMessageInterface
{
    /**
     * @param bool $disabled When true, the member has turned e-mail sign-in off:
     *                       no link is issued ($loginLink is empty); the handler
     *                       sends a short explanatory mail instead. Reusing this
     *                       (already async-routed) message keeps the delivery off
     *                       the web request, preserving enumeration safety.
     */
    public function __construct(private readonly string $userUuid, private readonly string $loginLink, private readonly bool $disabled = false)
    {
    }

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

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

    public function isDisabled(): bool
    {
        return $this->disabled;
    }

    public function getRelated(): array
    {
        return [
            User::class => $this->userUuid,
        ];
    }
}
