<?php

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

use App\Filament\Clusters\Loans\LoansCluster;
use App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Pages\CreateLoanOrderMobile;
use App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Pages\EditLoanOrderMobile;
use App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Pages\ListLoanOrderMobiles;
use App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Schemas\LoanOrderMobileForm;
use App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Tables\LoanOrderMobilesTable;
use App\Modules\LoanOrderMobile\Models\LoanOrderMobile;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class LoanOrderMobileResource extends Resource
{
    protected static ?string $model = LoanOrderMobile::class;

    protected static ?int $navigationSort = 3;

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

    protected static string|BackedEnum|null $activeNavigationIcon = Heroicon::DevicePhoneMobile;

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

    protected static ?string $recordTitleAttribute = 'unique_id';

    public static function getNavigationLabel(): string
    {
        return __('module.loan-order::loan-order.loan_order').' (mobile app)';
    }

    public static function getModelLabel(): string
    {
        return __('module.loan-order::loan-order.loan_order').' (mobile app)';
    }

    public static function getPluralModelLabel(): string
    {
        return __('module.loan-order::loan-order.loan_orders').' (mobile app)';
    }

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

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

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

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

    /**
     * @return Builder<\App\Modules\LoanOrder\Models\LoanOrder>
     */
    public static function getRecordRouteBindingEloquentQuery(): Builder
    {
        return parent::getRecordRouteBindingEloquentQuery()
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);
    }
}
