Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

765 B
Raw Blame
<?php

declare(strict_types=1);

namespace HiEvents\Services\Domain\EventLocation;

use HiEvents\DataTransferObjects\BaseDataObject;
use HiEvents\DomainObjects\Enums\LocationType;

class EventLocationData extends BaseDataObject
{
    public function __construct(
        public readonly LocationType $type,
        public readonly ?int $location_id = null,
        public readonly ?string $online_event_connection_details = null,
    ) {}

    public static function fromArray(array $payload): self
    {
        return new self(
            type: LocationType::fromName($payload['type']),
            location_id: $payload['location_id'] ?? null,
            online_event_connection_details: $payload['online_event_connection_details'] ?? null,
        );
    }
}