/**
 * Entity Hook System
 *
 * Provides lifecycle hooks for entities with support for plan limits,
 * flag system, child entities, and comprehensive hook management.
 */
import type { HookFunction, HookContext, HookResult, CRUDOperation, EntityConfig } from './types';
/**
 * Hook execution priority levels
 */
export declare enum HookPriority {
    HIGHEST = 0,
    HIGH = 10,
    NORMAL = 50,
    LOW = 90,
    LOWEST = 100
}
/**
 * Hook registration with priority
 */
interface HookRegistration {
    hook: HookFunction;
    priority: HookPriority;
    name?: string;
}
/**
 * Hook execution statistics
 */
interface HookStats {
    entityName: string;
    hookType: string;
    executionCount: number;
    averageExecutionTime: number;
    lastExecuted: Date;
}
/**
 * EntityHookManager - Manages lifecycle hooks for entities
 */
export declare class EntityHookManager {
    private hooks;
    private stats;
    private enabled;
    /**
     * Register a hook for a specific entity and hook type
     */
    registerHook(entityName: string, hookType: string, hook: HookFunction, priority?: HookPriority, name?: string): void;
    /**
     * Register hooks from entity configuration
     */
    registerEntityHooks(config: EntityConfig): void;
    /**
     * Execute hooks for a specific entity and hook type
     */
    executeHooks(entityName: string, hookType: string, context: HookContext): Promise<HookResult>;
    /**
     * Execute before hooks (can modify data and stop execution)
     */
    executeBeforeHooks(entityName: string, operation: CRUDOperation, context: HookContext): Promise<HookResult>;
    /**
     * Execute after hooks (notifications, cleanup, etc.)
     */
    executeAfterHooks(entityName: string, operation: CRUDOperation, context: HookContext): Promise<void>;
    /**
     * Execute plan limit hooks
     */
    executePlanLimitHooks(entityName: string, limitType: 'reached' | 'upgrade', context: HookContext): Promise<HookResult>;
    /**
     * Execute flag system hooks
     */
    executeFlagHooks(entityName: string, flagEvent: 'conflict' | 'granted' | 'denied', context: HookContext): Promise<HookResult>;
    /**
     * Execute child entity hooks
     */
    executeChildHooks(parentEntityName: string, childName: string, hookType: string, context: HookContext): Promise<HookResult>;
    /**
     * Remove hooks for an entity
     */
    removeEntityHooks(entityName: string): void;
    /**
     * Remove specific hook
     */
    removeHook(entityName: string, hookType: string, hookName?: string): void;
    /**
     * Get registered hooks for entity
     */
    getEntityHooks(entityName: string): Record<string, HookRegistration[]>;
    /**
     * Update hook execution statistics
     */
    private updateStats;
    /**
     * Get hook execution statistics
     */
    getStats(): HookStats[];
    /**
     * Enable/disable hook execution
     */
    setEnabled(enabled: boolean): void;
    /**
     * Clear all hooks and stats
     */
    clear(): void;
    /**
     * Get total number of registered hooks
     */
    getHookCount(): number;
}
export declare const entityHookManager: EntityHookManager;
export declare function registerHook(entityName: string, hookType: string, hook: HookFunction, priority?: HookPriority, name?: string): void;
export declare function executeEntityHooks(entityName: string, hookType: string, context: HookContext): Promise<HookResult>;
export declare function executeBeforeHooks(entityName: string, operation: CRUDOperation, context: HookContext): Promise<HookResult>;
export declare function executeAfterHooks(entityName: string, operation: CRUDOperation, context: HookContext): Promise<void>;
/**
 * Built-in hook: Log entity operations
 */
export declare const logOperationHook: HookFunction;
/**
 * Built-in hook: Validate required fields
 */
export declare const validateRequiredFieldsHook: HookFunction;
/**
 * Built-in hook: Check plan limits before creation
 */
export declare const checkPlanLimitsHook: HookFunction;
/**
 * Built-in hook: Audit trail for sensitive operations
 */
export declare const auditTrailHook: HookFunction;
export {};
//# sourceMappingURL=hooks.d.ts.map