<?php

use App\Filament\Columns\TimestampColumns;
use Filament\Tables\Columns\TextColumn;

describe('TimestampColumns', function () {
    it('returns array of timestamp columns', function () {
        $columns = TimestampColumns::make();

        expect($columns)->toBeArray()
            ->and($columns)->toHaveCount(3);
    });

    it('includes created_at column', function () {
        $columns = TimestampColumns::make();

        $hasCreatedAt = collect($columns)->contains(function ($column) {
            return $column instanceof TextColumn && $column->getName() === 'created_at';
        });

        expect($hasCreatedAt)->toBeTrue();
    });

    it('includes updated_at column', function () {
        $columns = TimestampColumns::make();

        $hasUpdatedAt = collect($columns)->contains(function ($column) {
            return $column instanceof TextColumn && $column->getName() === 'updated_at';
        });

        expect($hasUpdatedAt)->toBeTrue();
    });

    it('includes deleted_at column', function () {
        $columns = TimestampColumns::make();

        $hasDeletedAt = collect($columns)->contains(function ($column) {
            return $column instanceof TextColumn && $column->getName() === 'deleted_at';
        });

        expect($hasDeletedAt)->toBeTrue();
    });

    it('all columns are text columns', function () {
        $columns = TimestampColumns::make();

        foreach ($columns as $column) {
            expect($column)->toBeInstanceOf(TextColumn::class);
        }
    });
});
