<?php

namespace App\Filament\Resources;

use App\Filament\Clusters\DailyOps\DailyOpsCluster;
use App\Filament\Resources\TenantFeedbackResource\Pages\ListTenantFeedback;
use App\Filament\Resources\TenantFeedbackResource\Pages\ViewTenantFeedback;
use App\Filament\Resources\TenantFeedbackResource\Schemas\TenantFeedbackForm;
use App\Filament\Resources\TenantFeedbackResource\Schemas\TenantFeedbackInfolist;
use App\Filament\Resources\TenantFeedbackResource\Tables\TenantFeedbackTable;
use App\Models\TenantFeedback;
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 TenantFeedbackResource extends Resource
{
    protected static ?string $model = TenantFeedback::class;

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

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

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

    protected static ?int $navigationSort = 30;

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

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

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

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

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

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

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

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

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