<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use Filament\Forms\Components\Repeater;

class SlideRepeater extends Repeater
{
    public static function create(): static
    {
        return parent::make('slides')
            ->label('اسلایدها')
            ->relationship('slides')
            ->schema([
                TitleTextInput::create(),
                DescriptionTextarea::create(),
                UrlTextInput::create(),
                ImageFileUpload::create(),
                VideoFileUpload::create(),
                CreatedBySelect::create(),
                CreatedAtDateTimePicker::create(),
                UpdatedAtDateTimePicker::create(),
                DeletedAtDateTimePicker::create(),
            ])
            ->collapsed()
            ->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
            ->columnSpan(12);
    }
}
