<?php

namespace App\Filament\Resources\Teams\Schemas;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
use Illuminate\Support\Str;

class TeamForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('name')
                    ->required()
                    ->live(onBlur: true),
                TextInput::make('short_name'),
                TextInput::make('slug')
                    ->required()
                    ->hiddenOn('create')
                    ->dehydrateStateUsing(fn (?string $state): string => Str::slug((string) $state)),
                TextInput::make('fifa_code'),
                TextInput::make('flag_url')
                    ->url(),
                Toggle::make('is_active')
                    ->required(),
            ]);
    }
}
