import * as Y from 'yjs';
import { Server as SocketServer } from 'socket.io';
/**
 * Collaboration User Info
 */
export interface CollaborationUser {
    id: string;
    name: string;
    email?: string;
    avatar?: string;
    color: string;
    cursor?: {
        field: string;
        position: number;
    };
}
/**
 * Task Collaboration Document Structure
 */
export interface TaskDocument {
    id: string;
    title: Y.Text;
    description: Y.Text;
    status: Y.Text;
    priority: Y.Text;
    assignees: Y.Array<string>;
    tags: Y.Array<string>;
    subtasks: Y.Array<any>;
    comments: Y.Array<any>;
    attachments: Y.Array<any>;
    customFields: Y.Map<any>;
    metadata: Y.Map<any>;
}
/**
 * Project Collaboration Document Structure
 */
export interface ProjectDocument {
    id: string;
    name: Y.Text;
    description: Y.Text;
    tasks: Y.Array<string>;
    members: Y.Array<string>;
    settings: Y.Map<any>;
    metadata: Y.Map<any>;
}
/**
 * Change Event
 */
export interface ChangeEvent {
    documentId: string;
    type: 'task' | 'project';
    field: string;
    operation: 'add' | 'update' | 'delete';
    userId: string;
    timestamp: Date;
    oldValue?: any;
    newValue?: any;
    metadata?: Record<string, any>;
}
/**
 * Collaboration Service
 * Manages Y.js documents and real-time collaboration
 */
export declare class CollaborationService {
    private documents;
    private providers;
    private persistences;
    private awareness;
    private changeHistory;
    private io;
    private userColors;
    private activeUsers;
    private userSessions;
    private userPresence;
    private sectionAwareness;
    constructor();
    /**
     * Initialize collaboration service
     */
    private initializeService;
    /**
     * Set Socket.io server instance
     */
    setSocketServer(io: SocketServer): void;
    /**
     * Set up Socket.io event handlers
     */
    private setupSocketHandlers;
    /**
     * Create or get a Y.js document for a task
     */
    getTaskDocument(taskId: string): Y.Doc;
    /**
     * Create or get a Y.js document for a project
     */
    getProjectDocument(projectId: string): Y.Doc;
    /**
     * Set up change observers for a document
     */
    private setupChangeObservers;
    /**
     * Handle document changes
     */
    private handleDocumentChange;
    /**
     * Track individual field changes
     */
    private trackChange;
    /**
     * Handle user joining a document
     */
    private handleJoinDocument;
    /**
     * Handle user leaving a document
     */
    private handleLeaveDocument;
    /**
     * Handle document update from client
     */
    private handleDocumentUpdate;
    /**
     * Handle cursor position update
     */
    private handleCursorUpdate;
    /**
     * Handle awareness update
     */
    private handleAwarenessUpdate;
    /**
     * Handle user disconnect
     */
    private handleUserDisconnect;
    /**
     * Get user color for collaboration
     */
    private getUserColor;
    /**
     * Get change history for a document
     */
    getChangeHistory(documentId: string, limit?: number): ChangeEvent[];
    /**
     * Get active users for a document
     */
    getActiveUsers(documentId: string): string[];
    /**
     * Get active users with full information
     */
    getActiveUsersWithInfo(documentId: string): CollaborationUser[];
    /**
     * Get section awareness data
     */
    getSectionAwareness(section: string): any[];
    /**
     * Update user typing status
     */
    updateUserTypingStatus(documentId: string, userId: string, isTyping: boolean, field?: string): void;
    /**
     * Apply external changes to a document
     */
    applyExternalChange(documentId: string, field: string, value: any, userId?: string): void;
    /**
     * Create a snapshot of the current document state
     */
    createSnapshot(documentId: string): any;
    /**
     * Restore document from a snapshot
     */
    restoreFromSnapshot(documentId: string, snapshot: any, userId?: string): void;
    /**
     * Clean up resources for a document
     */
    cleanupDocument(documentId: string): void;
    /**
     * Get statistics for a document
     */
    getDocumentStats(documentId: string): {
        activeUsers: number;
        changeCount: number;
        lastModified?: Date;
        size: number;
    };
    /**
     * Create a detailed snapshot with metadata
     */
    createDetailedSnapshot(documentId: string, name: string, description?: string, userId?: string): any;
    /**
     * Get change history with enhanced filtering
     */
    getDetailedChangeHistory(documentId: string, options?: {
        limit?: number;
        field?: string;
        userId?: string;
        since?: Date;
        until?: Date;
    }): ChangeEvent[];
    /**
     * Get version comparison data
     */
    compareVersions(documentId: string, versionA: any, versionB: any): {
        field: string;
        type: "added" | "removed" | "modified";
        oldValue: any;
        newValue: any;
    }[];
    /**
     * Validate rollback operation
     */
    validateRollback(documentId: string, targetSnapshot: any): {
        isValid: boolean;
        warnings: string[];
        affectedFields: string[];
        conflictingUsers: string[];
    };
    /**
     * Create automatic snapshot before major operations
     */
    createAutoSnapshot(documentId: string, operation: string, userId?: string): any;
}
export declare const collaborationService: CollaborationService;
//# sourceMappingURL=collaborationService.d.ts.map