/**
 * 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
 *
 * ARCHITECTURE: This class is now a FACADE that delegates to the singleton
 * in queries.ts. There is NO internal Map - all data comes from the shared
 * singleton which is populated by the layout via setEntityRegistry().
 *
 * This unification ensures:
 * - API handlers see the same entities as client components
 * - Works in both monorepo and npm modes
 * - No require() calls that fail in pre-compiled npm packages
 */
export declare class EntityRegistry {
    /**
     * Register a new entity configuration
     * Adds to the singleton in queries.ts
     */
    register(config: EntityConfig): void;
    /**
     * Get entity configuration by slug
     * Delegates to singleton in queries.ts
     */
    get(slug: string): EntityConfig | undefined;
    /**
     * Get entity configuration by slug (alias for get)
     */
    getBySlug(slug: string): EntityConfig | undefined;
    /**
     * Get all registered entities
     * Delegates to singleton in queries.ts
     */
    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
     *
     * ARCHITECTURE: This is now a NO-OP for backwards compatibility.
     * The singleton in queries.ts is populated by:
     * - Server: The layout imports registry and calls setEntityRegistry()
     * - Client: DashboardShell calls setServerEntities() during hydration
     *
     * The EntityRegistry class is a facade - it doesn't need initialization.
     */
    initialize(): Promise<void>;
    /**
     * Get registry statistics
     */
    getStats(): {
        totalEntities: number;
        enabledEntities: number;
        entitiesWithChildren: number;
        entitiesWithExternalAPI: number;
    };
    /**
     * Update an existing entity configuration
     * Delegates to singleton in queries.ts
     */
    updateEntity(slug: string, updates: Partial<EntityConfig>): void;
    /**
     * Remove an entity from the registry
     * Delegates to singleton in queries.ts
     */
    removeEntity(slug: string): void;
    /**
     * Export all entity configurations
     */
    exportConfigs(): EntityConfig[];
    /**
     * Import entity configurations
     */
    importConfigs(configs: EntityConfig[]): void;
    /**
     * Check if registry is initialized
     * Delegates to singleton in queries.ts
     */
    isInitialized(): boolean;
    /**
     * Reset the registry (alias for clear)
     */
    reset(): void;
    /**
     * Clear all registered entities (mainly for testing)
     * Delegates to singleton in queries.ts
     */
    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