<?php

namespace App\Filament\Clusters\Loans\Loans;

use App\Filament\Clusters\Loans\Loans\Pages\ListLoans;
use App\Filament\Clusters\Loans\Loans\Schemas\LoanForm;
use App\Filament\Clusters\Loans\Loans\Tables\LoansTable;
use App\Filament\Clusters\Loans\LoansCluster;
use App\Modules\Loan\Models\Loan;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Illuminate\Contracts\Support\Htmlable;

class LoanResource extends Resource
{
    protected static ?int $navigationSort = 1;

    protected static ?string $model = Loan::class;

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

    public static function getNavigationIcon(): string|BackedEnum|Htmlable|null
    {
        return Heroicon::OutlinedBanknotes;
    }

    public static function getNavigationLabel(): string
    {
        return __('My loans');
    }

    public static function getModelLabel(): string
    {
        return __('Loan');
    }

    public static function getPluralModelLabel(): string
    {
        return __('Loans');
    }

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

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

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

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