<?php

namespace App\Filament\Resources\Articles\Schemas;

use App\Enums\Rubrique;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;

use Filament\Forms\Components\RichEditor;

class ArticleForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('titre')
                ->required()
                ->maxLength(255),
            Select::make('rubrique')
                ->options(Rubrique::class)
                ->default('actualites')
                ->required(),
            TextInput::make('auteur_nom')
                ->label('Auteur')
                ->maxLength(255),
            Textarea::make('extrait')
                ->label('Extrait (résumé court)')
                ->rows(2)
                ->maxLength(300),
            RichEditor::make('contenu')
                ->label('Contenu')
                ->required()
                ->columnSpanFull(),
            FileUpload::make('image')
                ->label('Image à la une')
                ->image()
                ->disk('public')
                ->directory('articles'),
            Toggle::make('publie')
                ->label('Publié'),
            ]);
    }
}
