<?php

namespace App\Filament\Clusters\Settings\LoanTypes\Schemas;

use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class LoanTypeForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TranslatableTabs::make()
                    ->schema([
                        TextInput::make('name')
                            ->label(__('Name'))
                            ->required()
                            ->maxLength(255),

                        Textarea::make('notes')
                            ->label(__('Notes'))
                            ->rows(3),
                    ]),

                Section::make()
                    ->columns(2)
                    ->schema([
                        TextInput::make('tax')
                            ->label(__('Tax'))
                            ->numeric()
                            ->suffix('%')
                            ->maxLength(255),

                        TextInput::make('maturity')
                            ->label(__('Loan term'))
                            ->maxLength(255),

                        Toggle::make('active')
                            ->label(__('Active'))
                            ->default(true)
                            ->required(),
                    ]),

            ]);
    }
}
