<?php

namespace App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters;

use App\Filament\Clusters\Loans\LoansCluster;
use App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Pages\CreateLoanPaidOffLetter;
use App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Pages\EditLoanPaidOffLetter;
use App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Pages\ListLoanPaidOffLetters;
use App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Schemas\LoanPaidOffLetterForm;
use App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Tables\LoanPaidOffLettersTable;
use App\Modules\LoanPaidOffLetter\Models\LoanPaidOffLetter;
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 LoanPaidOffLetterResource extends Resource
{
    protected static ?int $navigationSort = 3;

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

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

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

    public static function getNavigationLabel(): string
    {
        return __('Loan paid off letters');
    }

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

    public static function getPluralModelLabel(): string
    {
        return __('Loan paid off letters');
    }

    protected static ?string $recordTitleAttribute = 'loan_reason';

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

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

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

    public static function getPages(): array
    {
        return [
            'index' => ListLoanPaidOffLetters::route('/'),
            'create' => CreateLoanPaidOffLetter::route('/create'),
            'edit' => EditLoanPaidOffLetter::route('/{record}/edit'),
        ];
    }
}
