<?php

declare(strict_types=1);

namespace App\Filament\Resources\MediaFlags;

use App\Filament\Resources\MediaFlags\Pages\ListMediaFlags;
use App\Filament\Resources\MediaFlags\Tables\MediaFlagsTable;
use App\Filament\Support\NavigationBadge;
use App\Models\MediaFlag;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Tables\Table;
use UnitEnum;

class MediaFlagResource extends Resource
{
    protected static ?string $model = MediaFlag::class;

    protected static string|BackedEnum|null $navigationIcon = \Filament\Support\Icons\Heroicon::OutlinedFlag;

    protected static ?string $navigationLabel = 'گزارش‌های رسانه';

    protected static ?string $modelLabel = 'گزارش رسانه';

    protected static ?string $pluralModelLabel = 'گزارش‌های رسانه';

    protected static string|null|UnitEnum $navigationGroup = 'گالری و اسناد';

    protected static ?int $navigationSort = 3;

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

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

    public static function getNavigationBadge(): ?string
    {
        return NavigationBadge::fromQuery(fn () => static::getModel()::query());
    }

    public static function getNavigationBadgeColor(): ?string
    {
        return NavigationBadge::colorFromQuery(fn () => static::getModel()::query(), 'danger');
    }
}
