<?php

namespace App\Filament\Resources\Links;

use App\Filament\Resources\Links\Pages\CreateLink;
use App\Filament\Resources\Links\Pages\EditLink;
use App\Filament\Resources\Links\Pages\ListLinks;
use App\Filament\Resources\Links\Pages\ViewLink;
use App\Filament\Resources\Links\Schemas\LinkForm;
use App\Filament\Resources\Links\Schemas\LinkInfolist;
use App\Filament\Resources\Links\Tables\LinksTable;
use App\Models\Link;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

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

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

    protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-link';
    protected static string | \UnitEnum | null $navigationGroup = 'Treść';
    protected static ?string $pluralModelLabel = 'Przyciski';
    protected static ?string $modelLabel = 'Przyciski';
    protected static ?int $navigationSort = 6;

    protected static ?string $recordTitleAttribute = 'Link';

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

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