<?php

declare(strict_types=1);

namespace App\Modules\Room\Domain;

use App\Modules\Shared\Domain\Bus\Event\BusEvent;

final class RoomCreatedDomainEvent extends BusEvent
{
    public function __construct(
        int $id,
        private string $date,
        private string $dateUpdate,
        private string $name,
        private string $latitude,
        private string $longitude,
        private int $version,
        private int $status,
        private int $idAdmin,
        string $eventId = null,
        string $occurredOn = null
    ) {
        parent::__construct($id, $eventId, $occurredOn);
    }

    public static function eventName(): string
    {
        return 'route.created';
    }

    public static function fromPrimitives(
        int $aggregateId,
        array $body,
        string $eventId,
        string $occurredOn
    ): BusEvent {
        return new self(
            $aggregateId,
            $body['date'],
            $body['dateUpdate'],
            $body['name'],
            $body['latitude'],
            $body['longitude'],
            $body['version'],
            $body['status'],
            $body['idAdmin'],
            $eventId,
            $occurredOn
        );
    }

    public function toPrimitives(): array
    {
        return [
            'date' => $this->date,
            'dateUpdate' => $this->dateUpdate,
            'name' => $this->name,
            'latitude' => $this->latitude,
            'longitude' => $this->longitude,
            'version' => $this->version,
            'status' => $this->status,
            'idAdmin' => $this->idAdmin,
        ];
    }

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

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

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

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

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

    public function version(): int
    {
        return $this->version;
    }

    public function status(): int
    {
        return $this->status;
    }

    public function idAdmin(): int
    {
        return $this->idAdmin;
    }
}
