<?php

namespace App\Filament\Resources\Master\SubClassifications\Schemas;

use App\Models\Classification;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class SubClassificationForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('classification_id')
                    ->label('Klasifikasi Utama')
                    ->options(Classification::query()->active()->pluck('name', 'id'))
                    ->searchable()
                    ->native(false)
                    ->required()
                    ->rules(['exists:classifications,id'])
                    ->autofocus(),

                TextInput::make('name')
                    ->label('Nama Subklasifikasi')
                    ->placeholder('Korupsi')
                    ->autocomplete(false)
                    ->required()
                    ->maxLength(50),
            ])
            ->columns(1);
    }
}
