<?php

namespace App\Filament\Resources\TenantPackageResource\Pages;

use App\Filament\Resources\TenantPackageResource;
use App\Services\Audit\SuperAdminAuditLogger;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;

class ViewTenantPackage extends ViewRecord
{
    protected static string $resource = TenantPackageResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\EditAction::make()
                ->after(fn (array $data, $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
                    'updated',
                    $record,
                    SuperAdminAuditLogger::fieldsMetadata($data),
                    static::class
                )),
            Actions\DeleteAction::make()
                ->after(fn ($record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
                    'deleted',
                    $record,
                    source: static::class
                )),
        ];
    }
}
