<?php

namespace App\Filament\Clusters\DailyOps\Resources\Photos;

use App\Filament\Clusters\DailyOps\DailyOpsCluster;
use App\Filament\Clusters\DailyOps\Resources\Photos\Pages\ListPhotos;
use App\Filament\Clusters\DailyOps\Resources\Photos\Pages\ViewPhoto;
use App\Filament\Clusters\DailyOps\Resources\Photos\Schemas\PhotoForm;
use App\Filament\Clusters\DailyOps\Resources\Photos\Schemas\PhotoInfolist;
use App\Filament\Clusters\DailyOps\Resources\Photos\Tables\PhotosTable;
use App\Models\Photo;
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 PhotoResource extends Resource
{
    protected static ?string $model = Photo::class;

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

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

    protected static ?string $slug = 'moderation-queue';

    protected static ?string $recordTitleAttribute = 'id';

    protected static ?int $navigationSort = 20;

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

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

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

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

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

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

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

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

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