/**
 * Entity Registry System
 *
 * Central registry for managing entity configurations with comprehensive filtering,
 * permission checking, plan limits validation, and child entity support.
 *
 * MIGRATION: Now uses build-time registries (THEME_REGISTRY, PLUGIN_REGISTRY)
 * for zero runtime I/O and ~17,255x performance improvement
 *
 * SERVER-ONLY: This module is server-side only. Client components receive
 * entity configs as props from server components.
 */
import 'server-only';
import type { EntityConfig, EntityLimits, EntityAccessResult, EntityUsageStats, CRUDOperation, PlanType, UserFlag, ChildEntityConfig, ChildEntityDefinition } from './types';
import type { UserRole } from '../../types/user.types';
/**
 * EntityRegistry - Central management system for all entities
 */
export declare class EntityRegistry {
    private entities;
    private initialized;
    /**
     * Register a new entity configuration
     */
    register(config: EntityConfig): void;
    /**
     * Get entity configuration by slug (updated for new structure)
     */
    get(slug: string): EntityConfig | undefined;
    /**
     * Get entity configuration by slug
     */
    getBySlug(slug: string): EntityConfig | undefined;
    /**
     * Get all registered entities
     */
    getAll(): EntityConfig[];
    /**
     * Get only enabled entities
     */
    getEnabled(): EntityConfig[];
    /**
     * Get entities that have a specific feature enabled
     */
    getByFeature(feature: keyof EntityConfig['ui']['features']): EntityConfig[];
    /**
     * Get effective limits for user (returns unlimited for now since plans are not enforced)
     */
    getEffectiveLimits(entityName: string, planType: PlanType, userFlags?: UserFlag[]): EntityLimits;
    /**
     * Get child entities configuration for a parent entity
     */
    getChildEntities(parentEntityName: string): ChildEntityConfig | undefined;
    /**
     * Get specific child entity configuration
     */
    getChildConfig(parentEntityName: string, childName: string): ChildEntityDefinition | undefined;
    /**
     * Check if entity has child entities
     */
    hasChildEntities(entityName: string): boolean;
    /**
     * Get child entities for API inclusion based on requested children
     */
    getChildrenForAPI(parentEntityName: string, includedChildren?: string[]): ChildEntityDefinition[];
    /**
     * Validate entity configuration
     */
    private validateConfiguration;
    /**
     * Get detailed access result for user and entity (excluding plan validation)
     */
    getAccessResult(entityName: string, action: CRUDOperation, userRole: UserRole, planType: PlanType, userFlags?: UserFlag[]): EntityAccessResult;
    /**
     * Check if user is at or near entity limits
     */
    checkLimits(entityName: string, planType: PlanType, currentUsage: EntityUsageStats, userFlags?: UserFlag[]): {
        withinLimits: boolean;
        warnings: string[];
        errors: string[];
    };
    /**
     * Initialize registry
     * CLIENT-SAFE: Skips on client, loads from registries on server
     */
    initialize(): Promise<void>;
    /**
     * Server-only registry loading
     * Loads from build-time registries (ENTITY_REGISTRY with static imports)
     * PERFORMANCE: Zero runtime I/O, ~17,255x faster than old dynamic system
     *
     * Note: Uses static import (zero dynamic imports policy)
     */
    private loadFromRegistriesServer;
    /**
     * Get registry statistics
     */
    getStats(): {
        totalEntities: number;
        enabledEntities: number;
        entitiesWithChildren: number;
        entitiesWithExternalAPI: number;
    };
    /**
     * Update an existing entity configuration
     */
    updateEntity(slug: string, updates: Partial<EntityConfig>): void;
    /**
     * Remove an entity from the registry
     */
    removeEntity(slug: string): void;
    /**
     * Export all entity configurations
     */
    exportConfigs(): EntityConfig[];
    /**
     * Import entity configurations
     */
    importConfigs(configs: EntityConfig[]): void;
    /**
     * Check if registry is initialized
     */
    isInitialized(): boolean;
    /**
     * Reset the registry (alias for clear)
     */
    reset(): void;
    /**
     * Clear all registered entities (mainly for testing)
     */
    clear(): void;
}
export declare const entityRegistry: EntityRegistry;
export declare function registerEntity(config: EntityConfig): void;
export declare function getEntityConfig(name: string): EntityConfig | undefined;
export declare function getEnabledEntities(): EntityConfig[];
export declare function getEntityLimits(entityName: string, planType: PlanType, userFlags?: UserFlag[]): EntityLimits;
/**
 * Ensure the entity registry is fully initialized
 * MIGRATION: Now uses build-time registries (zero runtime I/O)
 */
export declare function ensureInitialized(): Promise<void>;
/**
 * Get all entity configurations (includes theme and plugin entities)
 */
export declare function getAllEntityConfigs(): EntityConfig[];
/**
 * Get registry statistics
 * MIGRATION: Now shows entities from theme and plugin registries
 */
export declare function getRegistryStats(): {
    totalEntities: number;
    enabledEntities: number;
    initialized: boolean;
    source: string;
};
//# sourceMappingURL=registry.d.ts.map