<?php

declare(strict_types=1);

namespace App\Modules\LodgingPlace\Domain;

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

final class LodgingPlaceCreatedDomainEvent extends BusEvent
{
    public function __construct(
        int $id,
        private string $date,
        private string $dateUpdate,
        private string $name,
        private string $icon,
        private string $iconThumb,
        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['icon'],
            $body['iconThumb'],
            $body['version'],
            $body['status'],
            $body['idAdmin'],
            $eventId,
            $occurredOn
        );
    }

    public function toPrimitives(): array
    {
        return [
            'date' => $this->date,
            'dateUpdate' => $this->dateUpdate,
            'name' => $this->name,
            'icon' => $this->icon,
            'iconThumb' => $this->iconThumb,
            '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 icon(): string
    {
        return $this->icon;
    }
    public function iconThumb(): string
    {
        return $this->iconThumb();
    }

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

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