<?php

namespace App\Filament\Resources\Projects\Schemas;

use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class ProjectForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema->components([
            Section::make('Referenzprojekt')->schema([
                TextInput::make('title')->label('Titel')->required(),
                TextInput::make('slug')->label('URL-Kürzel')->required()->unique(ignoreRecord: true)->alphaDash(),
                Textarea::make('summary')->label('Kurzbeschreibung')->rows(3)->columnSpanFull(),
                RichEditor::make('body')->label('Projektbeschreibung')->columnSpanFull(),
                TagsInput::make('services')->label('Leistungsbereiche')->columnSpanFull(),
                TextInput::make('location')->label('Ort'),
                TextInput::make('year')->label('Jahr')->numeric()->minValue(2000)->maxValue(2100),
                SpatieMediaLibraryFileUpload::make('cover_media')->label('Titelbild')->collection('cover')->image()->imageEditor()->columnSpanFull(),
                SpatieMediaLibraryFileUpload::make('gallery_media')->label('Projektgalerie')->collection('gallery')->image()->multiple()->reorderable()->maxFiles(20)->columnSpanFull(),
            ])->columns(2),
            Section::make('Veröffentlichung')->schema([
                Toggle::make('is_published')->label('Veröffentlicht')->required(),
                Toggle::make('is_featured')->label('Hervorheben')->required(),
            ])->columns(2),
        ]);
    }
}
