<?php

namespace App\Filament\Resources\EtabProfs\Schemas;

use Filament\Schemas\Schema;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\DatePicker;
use App\Models\Professeur;
use App\Models\Etablissement;

class EtabProfForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('professeur_id')
                    ->label('Professeur')
                    ->options(Professeur::all()->pluck('nomfr', 'id'))
                    ->searchable()
                    ->required(),
                
                Select::make('etablissement_id')
                    ->label('Établissement')
                    ->options(Etablissement::all()->pluck('libellefr', 'id'))
                    ->searchable()
                    ->required(),
                
                DatePicker::make('date_affectation')
                    ->label('Date d\'affectation')
                    ->required(),
                
                DatePicker::make('date_fin')
                    ->label('Date de fin')
                    ->nullable(),
            ]);
    }
}
