/**
 * @module database-designer.engine
 * @description Read-only data access engine for the Database Designer Angular UI.
 *
 * `DatabaseDesignerEngine` is a `BaseSingleton` (NOT an Angular service) that:
 *  - Loads the list of entities accessible to the current user
 *  - Loads full entity detail for the modify wizard
 *  - Loads available schemas from `MJ: Schema Info` (async, cached per-user)
 *  - Checks whether a proposed entity name / table name is available
 *
 * ### Why BaseSingleton, not @Injectable?
 * Engine classes hold a cross-request cache that must survive Angular's DI
 * lifecycle boundaries (the same instance is reused across multiple wizard
 * openings in the same session).  `BaseSingleton` uses the MJ Global Object
 * Store which guarantees exactly one instance per process, even across ESBuild
 * code-split chunks.
 *
 * ### Usage
 * ```typescript
 * const engine = DatabaseDesignerEngine.Instance;
 * const entities = await engine.loadAccessibleEntities();
 * ```
 *
 * @see DatabaseDesignerService — for action invocation (create, modify, validate)
 */
import { BaseSingleton } from '@memberjunction/global';
import type { AccessibleEntity, AccessibleEntityDetail, SchemaOption } from '../database-designer.types.js';
/**
 * Singleton data access engine for Database Designer.
 * All methods read data; none modifies state (mutations go through `DatabaseDesignerService`).
 */
export declare class DatabaseDesignerEngine extends BaseSingleton<DatabaseDesignerEngine> {
    static get Instance(): DatabaseDesignerEngine;
    protected constructor();
    /** Per-user entity list cache. Key = userID. */
    private readonly _cache;
    /** Per-user schema list cache. Key = userID. Invalidated alongside entity cache. */
    private readonly _schemaCache;
    /** Invalidate all per-user caches for the current user (call after create/modify). */
    invalidateCache(): void;
    /**
     * Load all entities accessible to the current user.
     *
     * - **Admin** (holds `Modify Any UDT Entities`): sees all entities created by
     *   Database Designer or Agent Manager, with ownership annotations.
     * - **Regular user**: sees only entities they own (`MJ:UDT:Owner = userId`).
     *
     * Results are cached per-user with a 5-minute TTL.
     */
    loadAccessibleEntities(): Promise<AccessibleEntity[]>;
    /**
     * Load full entity detail (columns, foreign keys, description) for the modify wizard.
     * Not cached — always fetches fresh data so the wizard reflects current DB state.
     */
    loadEntityDetail(entityId: string): Promise<AccessibleEntityDetail | null>;
    /**
     * Return the list of schemas the current user is authorized to create tables in.
     *
     * Async — queries `MJ: Schema Info` to surface real DB schemas for users
     * with `Create in Custom Schema` authorization.  Results are cached per-user
     * with the same 5-minute TTL as the entity list.
     *
     * Order:
     *   1. `__mj_UDT`  (if user holds `Create in UDT Schema`)
     *   2. Real DB schemas from `MJ: Schema Info`, excluding blocked schemas
     *      and `__mj_UDT` (already listed first)
     *   3. "Other (enter schema name)" free-text option, at the end
     *
     * All items beyond #1 require `Create in Custom Schema` authorization.
     */
    loadAvailableSchemas(): Promise<SchemaOption[]>;
    /** Build the schema option list: UDT first, then real DB schemas, then Other. */
    private fetchAvailableSchemas;
    /** Query `MJ: Schema Info` for distinct schema names registered with this MJ instance. */
    private loadDbSchemaNames;
    /**
     * Check whether the proposed entity name and table name are available
     * (no existing MJ entity in the same schema shares either).
     *
     * Returns true when the proposed names are safe to use.
     */
    isNameAvailable(entityName: string, tableName: string, schemaName: string): Promise<boolean>;
    /** Admin path: load all database-Designer-managed entities + ownership annotations. */
    private loadAllEntities;
    /** Non-admin path: load only entities owned by the current user. */
    private loadOwnedEntities;
    /** Check if the current user owns the given entity (via MJ:UDT:Owner setting). */
    private isCurrentUserOwner;
    /** True when the current user holds the `Modify Any UDT Entities` authorization. */
    private currentUserCanModifyAny;
    /** Map a `MJ: Entity Fields` row to a `ColumnSpec` for the detail view. */
    private mapFieldToColumnSpec;
}
//# sourceMappingURL=database-designer.engine.d.ts.map