import { DataSource, EntityManager } from 'typeorm';
import { ProjectEntity } from '../../entities/project.entity';
export interface CreateProjectDto {
    name: string;
    description?: string;
    status?: 'active' | 'on_hold' | 'completed' | 'archived';
    parentId?: string | null;
    priority?: 'low' | 'medium' | 'high' | 'critical';
    startDate?: Date;
    dueDate?: Date;
    metadata?: Record<string, any>;
}
export interface MoveNodeResult {
    success: boolean;
    message: string;
    affectedNodes?: number;
}
/**
 * Service for managing project hierarchy using materialized path pattern
 */
export declare class ProjectTreeService {
    private dataSource;
    private projectRepository;
    constructor(dataSource: DataSource);
    /**
     * Insert a new node into the tree
     */
    insertNode(projectData: CreateProjectDto, parentId?: string | null): Promise<ProjectEntity>;
    /**
     * Move a node to a new parent (or to root)
     */
    moveNode(projectId: string, newParentId: string | null): Promise<MoveNodeResult>;
    /**
     * Delete a node and optionally its descendants
     */
    deleteNode(projectId: string, cascade?: boolean): Promise<{
        success: boolean;
        message: string;
        deletedCount: number;
    }>;
    /**
     * Get all ancestors of a node
     */
    getAncestors(projectId: string, manager?: EntityManager): Promise<ProjectEntity[]>;
    /**
     * Get all descendants of a node
     */
    getDescendants(projectId: string, manager?: EntityManager): Promise<ProjectEntity[]>;
    /**
     * Get subtree starting from a specific node
     */
    getSubtree(rootId: string, maxDepth?: number): Promise<ProjectEntity[]>;
    /**
     * Get siblings of a node
     */
    getSiblings(projectId: string, includeSelf?: boolean): Promise<ProjectEntity[]>;
    /**
     * Get the full tree structure
     */
    getFullTree(): Promise<ProjectEntity[]>;
    /**
     * Rebuild materialized paths for the entire tree
     * Useful for fixing corrupted paths
     */
    rebuildPaths(): Promise<number>;
    /**
     * Helper: Rebuild paths for children of a node
     */
    private rebuildChildPaths;
    /**
     * Helper: Get next available path for a root node
     */
    private getNextRootPath;
    /**
     * Helper: Get next available path for a child node
     */
    private getNextChildPath;
    /**
     * Validate tree integrity
     */
    validateTreeIntegrity(): Promise<{
        valid: boolean;
        errors: string[];
    }>;
}
//# sourceMappingURL=project-tree.service.d.ts.map