<?php

namespace Datalumo\PhpSdk\DataObjects;

class Collection
{
    public function __construct(
        public readonly string $id,
        public readonly string $organisationId,
        public readonly string $name,
        public readonly ?string $project,
        public readonly string $createdAt,
        public readonly string $updatedAt,
    ) {}

    public static function fromArray(array $data): self
    {
        return new self(
            id: $data['id'],
            organisationId: $data['organisation_id'],
            name: $data['name'],
            project: $data['project'] ?? null,
            createdAt: $data['created_at'],
            updatedAt: $data['updated_at'],
        );
    }
}
