<?php

namespace App\Filament\Resources\NavigationLinks;

use App\Filament\Resources\NavigationLinks\Pages\CreateNavigationLink;
use App\Filament\Resources\NavigationLinks\Pages\EditNavigationLink;
use App\Filament\Resources\NavigationLinks\Pages\ListNavigationLinks;
use App\Filament\Resources\NavigationLinks\Pages\ViewNavigationLink;
use App\Filament\Resources\NavigationLinks\Schemas\NavigationLinkForm;
use App\Filament\Resources\NavigationLinks\Schemas\NavigationLinkInfolist;
use App\Filament\Resources\NavigationLinks\Tables\NavigationLinksTable;
use App\Models\NavigationLink;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class NavigationLinkResource extends Resource
{
    public static function canAccess(): bool
    {
        return auth()->user()?->can('admin') ?? false;
    }

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

    protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-bars-4';
    protected static string | \UnitEnum | null $navigationGroup = 'Treść';
    protected static ?string $pluralModelLabel = 'Nawigacja';
    protected static ?string $modelLabel = 'Nawigacja';
    protected static ?int $navigationSort = 5;
    protected static ?string $recordTitleAttribute = 'Nawigacja';

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

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

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

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

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