<?php

namespace App\Filament\Clusters\Settings\LoanTypes;

use App\Filament\Clusters\Settings\LoanTypes\Pages\ListLoanTypes;
use App\Filament\Clusters\Settings\LoanTypes\Schemas\LoanTypeForm;
use App\Filament\Clusters\Settings\LoanTypes\Schemas\LoanTypeInfolist;
use App\Filament\Clusters\Settings\LoanTypes\Tables\LoanTypesTable;
use App\Filament\Clusters\Settings\SettingsCluster;
use App\Modules\LoanOrder\Models\LoanType;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class LoanTypeResource extends Resource
{
    protected static ?string $model = LoanType::class;

    protected static ?string $cluster = SettingsCluster::class;

    protected static ?int $navigationSort = 1;

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;

    protected static ?string $recordTitleAttribute = 'name';

    public static function getNavigationGroup(): ?string
    {
        return __('module.loan-order::loan-order.loans');
    }

    public static function getModelLabel(): string
    {
        return __('module.loan-order::loan-type.loan_type');
    }

    public static function getPluralModelLabel(): string
    {
        return __('module.loan-order::loan-type.loan_type');
    }

    public static function form(Schema $schema): Schema
    {
        return LoanTypeForm::configure($schema);
    }

    public static function infolist(Schema $schema): Schema
    {
        return LoanTypeInfolist::configure($schema);
    }

    public static function table(Table $table): Table
    {
        return LoanTypesTable::configure($table);
    }

    public static function getRelations(): array
    {
        return [
            //
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListLoanTypes::route('/'),
        ];
    }
}
