<?php

namespace App\Filament\Resources\Tiers\Schemas;

use App\DataSourceFields;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class TierForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('name')
                    ->required(),
                TextInput::make('slug')
                    ->required(),
                Textarea::make('description')
                    ->columnSpanFull(),
                CheckboxList::make('allowed_fields')
                    ->label('Allowed Fields')
                    ->options(array_combine(
                        DataSourceFields::DVLA,
                        DataSourceFields::DVLA
                    ))
                    ->columns(3)
                    ->searchable()
                    ->bulkToggleable()
                    ->helperText('Select which fields this tier can access.')
                    ->columnSpanFull(),
            ]);
    }
}
