<?php

namespace App\Filament\Resources\AcademicResource\Pages;

use App\Filament\Resources\AcademicResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Gate;
class EditAcademic extends EditRecord
{
    protected static string $resource = AcademicResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\DeleteAction::make()
                ->before(function () {
                    // Add any pre-delete logic here
                })
                ->visible(fn () => Gate::allows('delete academic')),
            Actions\ForceDeleteAction::make()
                ->visible(fn () => Gate::allows('force delete academic')),
            Actions\RestoreAction::make()
                ->visible(fn () => Gate::allows('restore academic')),
        ];
    }

    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('index');
    }

    protected function getSavedNotification(): ?Notification
    {
        return Notification::make()
            ->success()
            ->title('Academic updated')
            ->body('The academic information has been updated successfully.');
    }

    protected function mutateFormDataBeforeSave(array $data): array
    {
        // Add any data transformation logic here
        return $data;
    }
}