/**
 * Policy Inheritance System
 *
 * Enables policy hierarchies with inheritance and override capabilities.
 * Implements FR150 for Epic 4.
 *
 * Features:
 * - Parent-child policy relationships
 * - Rule inheritance and overrides
 * - Conflict resolution
 * - Inheritance chain validation
 *
 * @packageDocumentation
 */
import type { ID } from '../../common/types.js';
import type { PolicyDefinition } from '../types.js';
/**
 * Policy inheritance relationship
 */
export interface PolicyInheritance {
    /** Child policy ID */
    policyId: ID;
    /** Parent policy ID */
    parentPolicyId: ID;
    /** Whether to inherit target scope */
    inheritTarget: boolean;
    /** Whether to inherit default action */
    inheritDefaultAction: boolean;
    /** Rules to exclude from inheritance */
    excludedRuleIds: string[];
    /** Override priority offset (added to parent rule priorities) */
    priorityOffset: number;
}
/**
 * Policy node in the hierarchy tree
 */
export interface PolicyHierarchyNode {
    policyId: ID;
    policyName: string;
    parentId?: ID;
    children: PolicyHierarchyNode[];
    depth: number;
}
/**
 * Merged policy result
 */
export interface MergedPolicy {
    /** The resulting merged definition */
    definition: PolicyDefinition;
    /** Source of each rule (which policy it came from) */
    ruleSources: Map<string, ID>;
    /** Conflicts that were resolved */
    conflicts: PolicyConflict[];
    /** Inheritance chain (from root to this policy) */
    inheritanceChain: ID[];
}
/**
 * Policy conflict during merge
 */
export interface PolicyConflict {
    /** Type of conflict */
    type: 'rule_override' | 'priority_collision' | 'action_conflict';
    /** Rule ID involved */
    ruleId: string;
    /** Source policy of the conflict */
    sourcePolicyId: ID;
    /** Target policy that caused the conflict */
    targetPolicyId: ID;
    /** How it was resolved */
    resolution: 'child_wins' | 'parent_wins' | 'merged';
    /** Description */
    description: string;
}
/**
 * Inheritance validation result
 */
export interface InheritanceValidationResult {
    valid: boolean;
    errors: string[];
    warnings: string[];
    maxDepth: number;
}
/**
 * Policy Inheritance Service
 *
 * Manages policy inheritance relationships and merging.
 */
export declare class PolicyInheritanceService {
    private inheritanceMap;
    private policyCache;
    /**
     * Set inheritance relationship
     */
    setInheritance(inheritance: PolicyInheritance): void;
    /**
     * Remove inheritance relationship
     */
    removeInheritance(policyId: ID): boolean;
    /**
     * Get parent policy ID
     */
    getParent(policyId: ID): ID | undefined;
    /**
     * Get all children of a policy
     */
    getChildren(policyId: ID): ID[];
    /**
     * Get the full inheritance chain (from root to policy)
     */
    getInheritanceChain(policyId: ID): ID[];
    /**
     * Build the policy hierarchy tree
     */
    buildHierarchy(policies: {
        id: ID;
        name: string;
    }[]): PolicyHierarchyNode[];
    /**
     * Validate inheritance relationships
     */
    validateInheritance(policyId: ID): InheritanceValidationResult;
    /**
     * Merge policy with its ancestors
     */
    mergeWithAncestors(policyId: ID, childPolicy: PolicyDefinition, getPolicyFn: (id: ID) => Promise<PolicyDefinition | null>): Promise<MergedPolicy>;
    /**
     * Internal merge implementation
     */
    private mergePolicy;
    /**
     * Merge policy targets
     */
    private mergeTargets;
    /**
     * Calculate depths recursively
     */
    private calculateDepths;
    /**
     * Cache a policy for inheritance lookups
     */
    cachePolicy(id: ID, policy: PolicyDefinition): void;
    /**
     * Clear the policy cache
     */
    clearCache(): void;
}
/**
 * Create a policy inheritance service instance
 */
export declare function createPolicyInheritanceService(): PolicyInheritanceService;
//# sourceMappingURL=inheritance.d.ts.map