<?php

namespace App\Filament\Resources\PaymentFines\Schemas;

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;

class PaymentFineForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Grid::make(3)
                    ->schema([
                        Section::make('Thông tin tiền phạt')
                            ->columnSpan(2)
                            ->columns(2)
                            ->schema([
                                Select::make('contract_id')
                                    ->label('Hợp đồng')
                                    ->relationship('contract', 'contract_number')
                                    ->searchable()
                                    ->preload()
                                    ->required(),

                                TextInput::make('amount')
                                    ->label('Số tiền phạt')
                                    ->numeric()
                                    ->prefix('VND')
                                    ->required(),

                                TextInput::make('reason')
                                    ->label('Lý do phạt')
                                    ->required(),

                                DatePicker::make('due_date')
                                    ->label('Ngày đến hạn nộp phạt')
                                    ->required(),

                                DatePicker::make('paid_date')
                                    ->label('Ngày thực nộp')
                                    ->nullable(),
                            ]),
                    ]),
            ]);
    }
}
