<?php

declare(strict_types=1);

namespace App\Administration\Domain\Event;

use App\Shared\Domain\DomainEvent;
use App\Shared\Domain\Tenant\TenantId;
use DateTimeImmutable;
use Override;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;

/**
 * Event emitted when a user's password is changed.
 *
 * This event triggers:
 * - Sending a confirmation email
 * - Audit logging
 */
final readonly class MotDePasseChange implements DomainEvent
{
    public function __construct(
        public string $userId,
        public string $email,
        public TenantId $tenantId,
        private DateTimeImmutable $occurredOn,
    ) {
    }

    #[Override]
    public function occurredOn(): DateTimeImmutable
    {
        return $this->occurredOn;
    }

    #[Override]
    public function aggregateId(): UuidInterface
    {
        return Uuid::fromString($this->userId);
    }
}
