/**
 * Multi-Tenant Memory Core
 * Enhanced memory core with complete tenant isolation and per-user operations
 */
import { MemoryCore } from './memory-core.js';
import { DatabaseConnection } from '../database/index.js';
import { MemoryType, ImportanceLevel } from '../types/enums.js';
import type { MCPToolResult } from '../types/base.js';
export interface UserBuffer {
    userId: string;
    maxSize: number;
    flushInterval: number;
    buffer: Array<Record<string, any>>;
    lastFlush: Date;
}
export interface UserQuota {
    maxMemories: number;
    maxEntities: number;
    maxInteractions: number;
    maxStorageBytes: number;
    dailyApiCalls: number;
}
export interface UserUsage {
    memoriesCount: number;
    entitiesCount: number;
    interactionsCount: number;
    storageBytes: number;
    dailyApiCalls: number;
    lastApiCall: Date;
}
export interface TenantStats {
    userId: string;
    usage: UserUsage;
    quota: UserQuota;
    isOverQuota: boolean;
    bufferStats?: any;
}
export declare class UserBufferManager {
    private buffers;
    private locks;
    getBuffer(userId: string): Promise<UserBuffer>;
    addToBuffer(userId: string, operation: Record<string, any>): Promise<boolean>;
    getAndClearBuffer(userId: string): Promise<Array<Record<string, any>>>;
    shouldFlush(userId: string): boolean;
    removeBuffer(userId: string): Promise<void>;
    flushAll(): Promise<Array<{
        userId: string;
        operations: Array<Record<string, any>>;
    }>>;
}
export declare class MultiTenantMemoryCore extends MemoryCore {
    private bufferManager;
    private memoryBuffer;
    private memoryWriter;
    private userQuotas;
    private userUsage;
    private rateLimits;
    private defaultQuota;
    constructor(db: DatabaseConnection, openaiApiKey?: string);
    /**
     * Initialize the multi-tenant memory core
     */
    initialize(): Promise<void>;
    /**
     * Close the multi-tenant memory core
     */
    close(): Promise<void>;
    /**
     * Set quota for a user
     */
    setUserQuota(userId: string, quota: Partial<UserQuota>): Promise<void>;
    /**
     * Get quota for a user
     */
    getUserQuota(userId: string): Promise<UserQuota>;
    /**
     * Check if user is within quota limits
     */
    checkQuota(userId: string, operation: string): Promise<{
        allowed: boolean;
        reason?: string;
    }>;
    /**
     * Get current usage for a user
     */
    getUserUsage(userId: string): Promise<UserUsage>;
    private calculateUserUsage;
    /**
     * Update usage after an operation
     */
    private updateUsage;
    /**
     * Add memory with quota checking and buffering
     */
    addMemory(title: string, content: string, memoryType?: MemoryType, options?: {
        userId?: string;
        importance?: ImportanceLevel;
        tags?: string[];
        entityIds?: number[];
        metadata?: Record<string, unknown>;
        generateEmbedding?: boolean;
        useBuffer?: boolean;
    }): Promise<MCPToolResult>;
    /**
     * Get tenant statistics
     */
    getTenantStats(userId: string): Promise<TenantStats>;
    /**
     * Get buffer status for a user
     */
    getBufferStatus(): Promise<any>;
    /**
     * Get writer statistics
     */
    getWriterStats(): Promise<any>;
}
//# sourceMappingURL=multi-tenant-memory-core.d.ts.map