<?php

declare(strict_types=1);

namespace App\Filament\Resources\DisciplinaryReports;

use App\Enums\NavigationGroup;
use App\Filament\Concerns\HasHrResourceLabels;
use App\Filament\Resources\DisciplinaryReports\Pages\CreateDisciplinaryReport;
use App\Filament\Resources\DisciplinaryReports\Pages\EditDisciplinaryReport;
use App\Filament\Resources\DisciplinaryReports\Pages\ListDisciplinaryReports;
use App\Filament\Resources\DisciplinaryReports\Pages\ViewDisciplinaryReport;
use App\Filament\Resources\DisciplinaryReports\Schemas\DisciplinaryReportForm;
use App\Filament\Resources\DisciplinaryReports\Schemas\DisciplinaryReportInfolist;
use App\Filament\Resources\DisciplinaryReports\Tables\DisciplinaryReportsTable;
use App\Models\DisciplinaryReport;
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 DisciplinaryReportResource extends Resource
{
    use HasHrResourceLabels;

    protected static ?string $model = DisciplinaryReport::class;

    protected static function hrLabelKeys(): array
    {
        return [
            'model' => 'disciplinary_report',
            'plural' => 'disciplinary_reports',
        ];
    }

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

    protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;

    protected static ?int $navigationSort = 1;

    protected static ?string $recordTitleAttribute = 'title';

    protected static bool $isGloballySearchable = false;

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

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

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

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

    public static function getPages(): array
    {
        return [
            'index' => ListDisciplinaryReports::route('/'),
            'create' => CreateDisciplinaryReport::route('/create'),
            'view' => ViewDisciplinaryReport::route('/{record}'),
            'edit' => EditDisciplinaryReport::route('/{record}/edit'),
        ];
    }

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