/**
 * Dependency Graph Types and Utilities
 * Manages table dependencies and seeding order for relationship-aware seeding
 */
export interface TableDependency {
    fromTable: string;
    toTable: string;
    relationship: 'required' | 'optional' | 'conditional' | 'circular';
    foreignKey: ForeignKeyRelationship;
    condition?: string;
    constraint?: string;
}
export interface ForeignKeyRelationship {
    constraintName: string;
    fromTable: string;
    fromColumn: string;
    toTable: string;
    toColumn: string;
    onDelete: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION' | 'SET DEFAULT';
    onUpdate: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION' | 'SET DEFAULT';
    isNullable: boolean;
    isDeferrable: boolean;
    schema: string;
}
export interface DependencyNode {
    table: string;
    schema: string;
    dependencies: string[];
    dependents: string[];
    depth: number;
    priority: number;
    isCircular: boolean;
    metadata: TableMetadata;
}
export interface TableMetadata {
    isJunctionTable: boolean;
    isTenantScoped: boolean;
    hasTimestamps: boolean;
    primaryKeyColumns: string[];
    foreignKeyCount: number;
    estimatedSize: 'small' | 'medium' | 'large';
    seedingComplexity: 'simple' | 'moderate' | 'complex';
}
export interface DependencyEdge {
    from: string;
    to: string;
    type: 'required' | 'optional' | 'conditional';
    weight: number;
    constraint: string;
    canBeCircular: boolean;
}
export interface CircularDependency {
    tables: string[];
    edges: DependencyEdge[];
    resolutionStrategy: 'defer_constraints' | 'null_initially' | 'post_insert_update' | 'manual';
    resolutionOrder: string[];
    complexity: 'simple' | 'moderate' | 'complex';
}
export interface DependencyGraph {
    nodes: DependencyNode[];
    edges: DependencyEdge[];
    cycles: CircularDependency[];
    seedingOrder: string[];
    creationOrder: string[];
    deletionOrder: string[];
    metadata: GraphMetadata;
}
export interface GraphMetadata {
    totalTables: number;
    totalRelationships: number;
    circularDependencies: number;
    maxDepth: number;
    complexity: 'simple' | 'moderate' | 'complex' | 'very_complex';
    analysisTimestamp: string;
    confidence: number;
    warnings: string[];
    recommendations: string[];
}
export interface SeedingOrderOptions {
    respectCircularDependencies: boolean;
    prioritizeJunctionTables: boolean;
    groupByTenant: boolean;
    includeMetadata: boolean;
    optimizeForPerformance: boolean;
    handleOptionalRelationships: 'ignore' | 'defer' | 'include';
}
export interface SeedingOrderResult {
    success: boolean;
    seedingOrder: string[];
    phases: SeedingPhase[];
    circularDependenciesResolved: CircularDependency[];
    warnings: string[];
    errors: string[];
    metadata: {
        totalPhases: number;
        estimatedSeedingTime: number;
        complexity: string;
        recommendations: string[];
    };
}
export interface SeedingPhase {
    phase: number;
    tables: string[];
    description: string;
    canRunInParallel: boolean;
    estimatedTime: number;
    dependencies: string[];
    requirements: string[];
}
export declare class DependencyGraphBuilder {
    private nodes;
    private edges;
    private cycles;
    /**
     * Add a table node to the graph
     */
    addNode(table: string, schema?: string, metadata?: Partial<TableMetadata>): void;
    /**
     * Add a dependency edge between tables
     */
    addEdge(from: string, to: string, relationship: ForeignKeyRelationship): void;
    /**
     * Build the complete dependency graph
     */
    build(): DependencyGraph;
    /**
     * Calculate seeding order using topological sort
     */
    calculateSeedingOrder(options?: Partial<SeedingOrderOptions>): string[];
    /**
     * Calculate seeding order with phases for parallel execution
     */
    calculateSeedingOrderWithPhases(options?: Partial<SeedingOrderOptions>): SeedingOrderResult;
    private calculateDepthsAndPriorities;
    private detectCircularDependencies;
    private addCircularDependency;
    private determineCircularResolutionStrategy;
    private calculateCircularResolutionOrder;
    private calculateRelationshipWeight;
    private calculateNodePriority;
    private isCircularEdge;
    private generateGraphMetadata;
    private calculateConfidence;
    private generateWarnings;
    private generateRecommendations;
    private calculateComplexity;
}
//# sourceMappingURL=dependency-graph.d.ts.map