<?php

declare(strict_types=1);

namespace App\Framework\Database\Events\Examples;

/**
 * Example Entity for demonstration purposes
 */
final class ExampleUser
{
    public readonly string $id;

    public function __construct(
        public readonly string $email,
        public readonly string $name,
        ?string $id = null
    ) {
        $this->id = $id ?? uniqid('user_');
    }

    public function updateEmail(string $newEmail): self
    {
        return new self($newEmail, $this->name, $this->id);
    }
}
