<?php

namespace App\Filament\Resources;

use App\Filament\Clusters\RareAdmin\RareAdminCluster;
use App\Filament\Resources\DataExportResource\Pages\CreateDataExport;
use App\Filament\Resources\DataExportResource\Pages\ListDataExports;
use App\Filament\Resources\DataExportResource\Schemas\DataExportForm;
use App\Filament\Resources\DataExportResource\Tables\DataExportTable;
use App\Models\DataExport;
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 UnitEnum;

class DataExportResource extends Resource
{
    protected static ?string $model = DataExport::class;

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

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

    protected static UnitEnum|string|null $navigationGroup = null;

    protected static ?int $navigationSort = 50;

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

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

    public static function getNavigationLabel(): string
    {
        return __('admin.data_exports.navigation.label');
    }

    public static function getNavigationGroup(): UnitEnum|string|null
    {
        return __('admin.nav.platform');
    }

    public static function getEloquentQuery(): Builder
    {
        return parent::getEloquentQuery()->with(['tenant', 'event', 'user']);
    }

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

    public static function canEdit($record): bool
    {
        return false;
    }

    public static function canDelete($record): bool
    {
        return false;
    }

    public static function canDeleteAny(): bool
    {
        return false;
    }
}
