<?php

use Datalumo\PhpSdk\DataObjects\Collection;

it('creates a collection from array', function () {
    $collection = Collection::fromArray([
        'id' => 'col-123',
        'organisation_id' => 'org-456',
        'name' => 'My Collection',
        'project' => 'docs',
        'created_at' => '2026-01-01T00:00:00Z',
        'updated_at' => '2026-01-02T00:00:00Z',
    ]);

    expect($collection)
        ->id->toBe('col-123')
        ->organisationId->toBe('org-456')
        ->name->toBe('My Collection')
        ->project->toBe('docs')
        ->createdAt->toBe('2026-01-01T00:00:00Z')
        ->updatedAt->toBe('2026-01-02T00:00:00Z');
});

it('handles null project', function () {
    $collection = Collection::fromArray([
        'id' => 'col-123',
        'organisation_id' => 'org-456',
        'name' => 'My Collection',
        'project' => null,
        'created_at' => '2026-01-01T00:00:00Z',
        'updated_at' => '2026-01-02T00:00:00Z',
    ]);

    expect($collection->project)->toBeNull();
});
