<?php

namespace App\Filament\Resources\Monitoring\IssueManagements;

use App\Filament\Resources\Monitoring\IssueManagements\Pages\CreateIssueManagement;
use App\Filament\Resources\Monitoring\IssueManagements\Pages\EditIssueManagement;
use App\Filament\Resources\Monitoring\IssueManagements\Pages\ListIssueManagements;
use App\Filament\Resources\Monitoring\IssueManagements\Schemas\IssueManagementForm;
use App\Filament\Resources\Monitoring\IssueManagements\Tables\IssueManagementTable;
use App\Models\IssueManagement;
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 Illuminate\Database\Eloquent\SoftDeletingScope;
use UnitEnum;

class IssueManagementResource extends Resource
{
    protected static ?string $model = IssueManagement::class;

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

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

    protected static ?string $navigationLabel = 'Manajemen Isu';

    protected static ?int $navigationSort = 2;

    protected static ?string $recordTitleAttribute = 'mediaMonitoring.title';

    protected static ?string $slug = 'monitoring/issue-managements';

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

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

    public static function getPages(): array
    {
        return [
            'index' => ListIssueManagements::route('/'),
            'create' => CreateIssueManagement::route('/create'),
            'edit' => EditIssueManagement::route('/{record}/edit'),
        ];
    }

    public static function getRecordRouteBindingEloquentQuery(): Builder
    {
        return parent::getRecordRouteBindingEloquentQuery()
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);
    }
}
