<?php

namespace App\Filament\Resources\Corridors\Schemas;

use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;

class CorridorForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('from_city_id')
                    ->label('From City')
                    ->relationship('fromCity', 'name_en')
                    ->searchable()
                    ->preload()
                    ->required(),
                Select::make('to_city_id')
                    ->label('To City')
                    ->relationship('toCity', 'name_en')
                    ->searchable()
                    ->preload()
                    ->required(),
                TextInput::make('min_price_tzs')
                    ->label('Minimum Price (TZS)')
                    ->helperText('Floor price enforced when drivers post trips on this route')
                    ->required()
                    ->numeric()
                    ->prefix('TZS')
                    ->minValue(0)
                    ->default(0),
                TextInput::make('distance_km')
                    ->label('Distance (km)')
                    ->required()
                    ->numeric()
                    ->suffix('km')
                    ->minValue(1),
                Toggle::make('is_active')
                    ->label('Active (visible to drivers & riders)')
                    ->required(),
            ]);
    }
}
