<?php

namespace App\Filament\Resources\PricelistFiles;

use App\Filament\Resources\PricelistFiles\Pages\CreatePricelistFile;
use App\Filament\Resources\PricelistFiles\Pages\EditPricelistFile;
use App\Filament\Resources\PricelistFiles\Pages\ListPricelistFiles;
use App\Filament\Resources\PricelistFiles\Pages\ViewPricelistFile;
use App\Filament\Resources\PricelistFiles\Schemas\PricelistFileForm;
use App\Filament\Resources\PricelistFiles\Schemas\PricelistFileInfolist;
use App\Filament\Resources\PricelistFiles\Tables\PricelistFilesTable;
use App\Models\PricelistFile;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Filament\Support\Enums\Width;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class PricelistFileResource extends Resource
{
    protected static ?string $model = PricelistFile::class;

    protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-document-text';

    protected static ?string $navigationLabel = 'Árlista feldolgozó';

    protected static ?string $breadcrumb = 'Árlista feldolgozó';

    protected static ?string $pluralLabel = 'Árlista feldolgozó';

    protected static ?string $modelLabel = 'Árlista fájl';

    public static function getMaxWidth(): Width|string|null
    {
        return Width::Full;
    }

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

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

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

    public static function getRelations(): array
    {
        return [
            RelationManagers\LinesRelationManager::class,
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListPricelistFiles::route('/'),
            'create' => CreatePricelistFile::route('/create'),
            'view' => ViewPricelistFile::route('/{record}'),
            'edit' => EditPricelistFile::route('/{record}/edit'),
        ];
    }

    public static function getRecordRouteBindingEloquentQuery(): Builder
    {
        return parent::getRecordRouteBindingEloquentQuery()
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);
    }
}
