import type { AfterLifecycleHookEvent, LifecycleHookContext } from '@admin/lib/lifecycle-hooks/types' export function entityEventPayload( hook: AfterLifecycleHookEvent, context: LifecycleHookContext ): unknown { if (hook === 'afterRestore') { return { record: context.data ?? null, restoredFromVersion: context.metadata?.restoredFromVersion ?? null } } if (hook === 'afterDelete') { return context.data ?? { id: context.entityId ?? null } } return context.data ?? null }