<?php

namespace App\Filament\Resources\PermissionResource\Pages;

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

    protected function getHeaderActions(): array
    {
        return [
            Actions\DeleteAction::make()
                ->visible(fn () => Gate::allows('delete permission')),
            Actions\ForceDeleteAction::make()
                ->visible(fn () => Gate::allows('force delete permission')),
            Actions\RestoreAction::make()
                ->visible(fn () => Gate::allows('restore permission')),
        ];
    }
    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('index');
    }
    protected function getSavedNotification(): ?Notification
    {
        return Notification::make()
            ->success()
            ->title('Permission updated')
            ->body('The permission has been saved successfully.');
    }
}
