<?php

namespace App\Filament\Resources\Fixtures\Schemas;

use App\Enums\MatchOutcome;
use App\Enums\MatchStatus;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class FixtureForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('home_team_id')
                    ->relationship('homeTeam', 'name')
                    ->required(),
                Select::make('away_team_id')
                    ->relationship('awayTeam', 'name')
                    ->required(),
                TextInput::make('stage'),
                TextInput::make('venue'),
                DateTimePicker::make('starts_at')
                    ->required(),
                DateTimePicker::make('picks_lock_at')
                    ->hiddenOn('create'),
                Select::make('status')
                    ->options(MatchStatus::class)
                    ->default('scheduled')
                    ->hiddenOn('create')
                    ->required(),
                TextInput::make('home_score')
                    ->numeric()
                    ->hiddenOn('create'),
                TextInput::make('away_score')
                    ->numeric()
                    ->hiddenOn('create'),
                Select::make('result')
                    ->options(MatchOutcome::class)
                    ->hiddenOn('create'),
                DateTimePicker::make('result_declared_at')
                    ->hiddenOn('create'),
            ]);
    }
}
