/**
 * @fileoverview Vector Management Resource Component
 *
 * Dashboard resource for managing vector databases and entity vectorization.
 * Displays KPI cards (total vectors, entities synced, last sync, avg embedding time),
 * an entity sync table, and sidebar panels for DB health, embedding model info,
 * and storage usage.
 */
import { OnDestroy, AfterViewInit } from '@angular/core';
import { ResourceData } from '@memberjunction/core-entities';
import { MJVectorDatabaseEntity } from '@memberjunction/core-entities';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { KPICardData } from '../widgets/kpi-card.component';
import * as i0 from "@angular/core";
/** Flattened row for the entity sync table */
interface EntitySyncRow {
    EntityDocumentID: string;
    EntityName: string;
    DocumentName: string;
    VectorCount: number;
    LastSynced: Date | null;
    Status: 'Synced' | 'Syncing' | 'Error' | 'Pending';
    /** Percent complete during active sync (0-100) */
    PercentComplete: number;
    /** Pipeline run ID for tracking active subscription */
    PipelineRunID?: string;
}
/** Sidebar embedding model summary */
interface EmbeddingModelInfo {
    Name: string;
    Dimensions: number | null;
}
/** Result from AI document suggestion */
interface DocumentSuggestionResult {
    template: string;
    selectedFields: string[];
    selectedRelationships: {
        name: string;
        fields: string[];
    }[];
    potentialMatchThreshold: number;
    absoluteMatchThreshold: number;
    reasoning: string;
}
export declare class VectorManagementResourceComponent extends BaseResourceComponent implements AfterViewInit, OnDestroy {
    private cdr;
    private destroy$;
    /** View mode: 'index' = Option A (shared index as hero, entity docs as children),
     *  'operations' = Option C (operations monitoring with real-time sync status) */
    ViewMode: 'index' | 'operations';
    /** Whether this component is embedded inside the Knowledge Hub shell */
    EmbeddedMode: boolean;
    /** Toggle between view modes */
    ToggleViewMode(): void;
    IsLoading: boolean;
    KPICards: KPICardData[];
    SyncRows: EntitySyncRow[];
    SyncingIds: Set<string>;
    VectorDBName: string;
    VectorDBStatus: 'Healthy' | 'Degraded' | 'Offline';
    EmbeddingModel: EmbeddingModelInfo;
    StorageUsagePercent: number;
    TotalVectors: number;
    ShowEditPanel: boolean;
    IsEditSaving: boolean;
    IsEditDeleting: boolean;
    EditDocID: string;
    EditDocName: string;
    EditDocEntityName: string;
    EditDocVectorDBID: string;
    EditDocAIModelID: string;
    EditDocVectorIndexID: string;
    EditDocStatus: string;
    /** Open the edit panel for an entity document */
    OpenEditPanel(entityDocumentId: string): void;
    CloseEditPanel(): void;
    SaveEditedDocument(): Promise<void>;
    DeleteEntityDocument(): Promise<void>;
    ShowSuggestDialog: boolean;
    IsSuggesting: boolean;
    SuggestEntityName: string;
    SuggestUseCase: string;
    SuggestionResult: DocumentSuggestionResult | null;
    SaveDocumentName: string;
    SuggestionError: string;
    IsSavingDocument: boolean;
    EditableTemplate: string;
    /** Prerequisites check — are vector DB and embedding model configured? */
    HasVectorDB: boolean;
    HasEmbeddingModel: boolean;
    get PrerequisitesMet(): boolean;
    /** Available embedding models for selection in save form */
    AvailableEmbeddingModels: {
        ID: string;
        Name: string;
    }[];
    /** Selected embedding model ID for the new entity document */
    SelectedEmbeddingModelID: string;
    /** Selected vector database ID for the new entity document */
    SelectedVectorDBID: string;
    /** Available vector indexes for selection */
    AvailableVectorIndexes: {
        ID: string;
        Name: string;
        VectorDatabaseID: string;
        EmbeddingModelID: string;
    }[];
    /** Selected vector index ID — if user picks an existing one */
    SelectedVectorIndexID: string;
    /** Indexes filtered by the currently selected vector DB (for create/edit forms) */
    get FilteredIndexesForSelectedDB(): {
        ID: string;
        Name: string;
        VectorDatabaseID: string;
        EmbeddingModelID: string;
    }[];
    /** Indexes filtered by the edit panel's selected vector DB */
    get EditFilteredIndexes(): {
        ID: string;
        Name: string;
        VectorDatabaseID: string;
        EmbeddingModelID: string;
    }[];
    /** Grouped entity list for the suggestion panel — schemas as groups, entities as items */
    EntityGroups: {
        SchemaName: string;
        Entities: {
            Name: string;
            ID: string;
        }[];
    }[];
    /** Filtered entity groups based on search input */
    FilteredEntityGroups: {
        SchemaName: string;
        Entities: {
            Name: string;
            ID: string;
        }[];
    }[];
    /** Search text for filtering entities */
    EntitySearchText: string;
    /** Whether the entity picker dropdown is open */
    ShowEntityPicker: boolean;
    private entityDocuments;
    protected vectorDatabases: MJVectorDatabaseEntity[];
    private vectorIndexes;
    private recordDocuments;
    private aiModels;
    ngAfterViewInit(): Promise<void>;
    ngOnDestroy(): void;
    GetResourceDisplayName(_data: ResourceData): Promise<string>;
    GetResourceIconClass(_data: ResourceData): Promise<string>;
    /** Reload all dashboard data */
    LoadData(): Promise<void>;
    /** Trigger vectorization for a specific entity document via GraphQL (fire-and-forget with progress subscription) */
    SyncEntity(entityDocumentId: string): Promise<void>;
    /** Subscribe to PipelineProgress for a specific pipeline run */
    private subscribeToPipelineProgress;
    /**
     * Add an ID to SyncingIds, creating a new Set reference so Angular
     * change detection picks up the mutation in template bindings.
     */
    private addSyncingId;
    /**
     * Remove an ID from SyncingIds, creating a new Set reference so Angular
     * change detection picks up the mutation in template bindings.
     */
    private removeSyncingId;
    /** Opens the AI suggestion dialog */
    OpenSuggestDialog(): void;
    /** Select an entity from the grouped picker */
    SelectEntity(entityName: string): void;
    /** Filter entities by search text */
    FilterEntities(): void;
    /** Toggle entity picker visibility */
    ToggleEntityPicker(): void;
    /** Handle template edits from code editor */
    OnTemplateChange(newValue: string): void;
    /** Closes the suggestion dialog */
    CloseSuggestDialog(): void;
    /** Clears the current suggestion to try again */
    ClearSuggestion(): void;
    /**
     * Runs the AI suggestion by calling the server-side "Entity Document Suggestion"
     * AI prompt via GraphQL. The LLM analyzes the entity schema and generates
     * natural language Nunjucks templates optimized for embedding quality.
     */
    RunSuggestion(): Promise<void>;
    /** Saves the current suggestion as an Entity Document record */
    SaveAsEntityDocument(): Promise<void>;
    /** Returns the CSS class for a given sync status badge */
    GetStatusClass(status: string): string;
    /** Returns the icon class for a given sync status */
    GetStatusIcon(status: string): string;
    /** Format a Date value for display */
    FormatDate(date: Date | null): string;
    /** Format the storage gauge label */
    get StorageLabel(): string;
    /** CSS class for the DB health indicator dot */
    get DBHealthClass(): string;
    private fetchAllData;
    private buildSyncRows;
    private computeLastSynced;
    private computeSyncStatus;
    private buildKPICards;
    private buildSidebarData;
    private buildVectorDBHealth;
    private buildEmbeddingModelInfo;
    private buildStorageUsage;
    /** Check if vector DB and embedding model are configured, populate selection lists */
    private checkPrerequisites;
    /** Find the best embedding model from loaded AI models */
    private findEmbeddingModel;
    /**
     * Populate required foreign key fields on an Entity Document before saving.
     * Throws if prerequisites are not met.
     */
    private populateEntityDocumentFKs;
    /** Create a Template + TemplateContent record for the entity document */
    private createTemplateForDocument;
    /** Build grouped entity list from metadata, grouped by SchemaName */
    private loadEntityGroups;
    private updateRowStatus;
    private updateRowProgress;
    /** Refresh a single sync row's vector count and status from the DB */
    private refreshSyncRow;
    /**
     * Calls the "Entity Document Suggestion" AI prompt via GraphQL to generate
     * a natural language template optimized for vector embeddings.
     */
    private callSuggestionPrompt;
    /** Find the Entity Document Suggestion prompt from AIEngineBase */
    private findSuggestionPrompt;
    /** Build the data payload for the suggestion prompt */
    private buildPromptData;
    static ɵfac: i0.ɵɵFactoryDeclaration<VectorManagementResourceComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<VectorManagementResourceComponent, "app-vector-management-resource", never, { "EmbeddedMode": { "alias": "EmbeddedMode"; "required": false; }; }, {}, never, never, false, never>;
}
export declare function LoadVectorManagementResource(): void;
export {};
//# sourceMappingURL=vector-management-resource.component.d.ts.map