/**
 * Security Policy Engine
 *
 * Core engine for evaluating dynamic security policies.
 * Provides policy management, evaluation, and enforcement capabilities.
 *
 * @packageDocumentation
 */
import { type ConditionEvaluatorOptions, type CustomExpressionEvaluator } from './condition-evaluator.js';
import { type RuleEvaluatorOptions, type RateLimiter, type GeoLocationProvider, type CustomRuleHandler } from './rule-evaluator.js';
import type { SecurityPolicy, PolicyContext, PolicyDecision, DecisionOutcome, PolicyVersionRecord, PolicyValidationResult, PolicySimulationRequest, PolicySimulationResult } from './types.js';
/**
 * Policy update listener
 */
export type PolicyUpdateListener = (policyId: string, action: 'add' | 'update' | 'remove', policy?: SecurityPolicy) => void;
/**
 * Break-glass validator
 */
export type BreakGlassValidator = (token: string, context: PolicyContext) => Promise<{
    valid: boolean;
    reason?: string;
    expiresAt?: string;
    grantedBy?: string;
}>;
/**
 * Security policy engine options
 */
export interface SecurityPolicyEngineOptions {
    /** Condition evaluator options */
    conditionEvaluator?: ConditionEvaluatorOptions;
    /** Rule evaluator options */
    ruleEvaluator?: RuleEvaluatorOptions;
    /** Enable OpenTelemetry tracing */
    enableTracing?: boolean;
    /** Maximum policies to evaluate per request */
    maxPoliciesToEvaluate?: number;
    /** Enable policy caching */
    enableCaching?: boolean;
    /** Cache TTL in milliseconds */
    cacheTtlMs?: number;
    /** Break-glass token validator */
    breakGlassValidator?: BreakGlassValidator;
    /** Default decision when no policies match */
    defaultDecision?: DecisionOutcome;
    /** Enable policy versioning */
    enableVersioning?: boolean;
    /** Maximum versions to keep per policy */
    maxVersionsPerPolicy?: number;
}
/**
 * SecurityPolicyEngine class
 */
export declare class SecurityPolicyEngine {
    private policies;
    private policyVersions;
    private updateListeners;
    private conditionEvaluator;
    private ruleEvaluator;
    private breakGlassValidator?;
    private options;
    constructor(options?: SecurityPolicyEngineOptions);
    /**
     * Evaluate all applicable policies against the context
     */
    evaluate(context: PolicyContext): Promise<PolicyDecision>;
    /**
     * Evaluate with OpenTelemetry tracing
     */
    evaluateWithTracing(context: PolicyContext): Promise<PolicyDecision>;
    /**
     * Evaluate a single policy
     */
    private evaluatePolicy;
    /**
     * Get actions for failed rules
     */
    private getFailedRuleActions;
    /**
     * Determine final outcome from matched policies
     */
    private determineOutcome;
    /**
     * Determine reason for decision
     */
    private determineReason;
    /**
     * Create a policy decision
     */
    private createDecision;
    /**
     * Get applicable policies for the context
     */
    getApplicablePolicies(context: PolicyContext): SecurityPolicy[];
    /**
     * Check if a policy is applicable based on basic criteria
     */
    private isPolicyApplicable;
    /**
     * Add a policy
     */
    addPolicy(policy: SecurityPolicy): void;
    /**
     * Remove a policy
     */
    removePolicy(policyId: string): boolean;
    /**
     * Update a policy
     */
    updatePolicy(policyId: string, updates: Partial<SecurityPolicy>): SecurityPolicy;
    /**
     * Get a policy by ID
     */
    getPolicy(policyId: string): SecurityPolicy | undefined;
    /**
     * Get all policies
     */
    getAllPolicies(): SecurityPolicy[];
    /**
     * Get enabled policies
     */
    getEnabledPolicies(): SecurityPolicy[];
    /**
     * Enable a policy
     */
    enablePolicy(policyId: string): boolean;
    /**
     * Disable a policy
     */
    disablePolicy(policyId: string): boolean;
    /**
     * Add a policy version
     */
    private addPolicyVersion;
    /**
     * Get policy versions
     */
    getPolicyVersions(policyId: string): PolicyVersionRecord[];
    /**
     * Rollback policy to a previous version
     */
    rollbackPolicy(policyId: string, versionId: string): SecurityPolicy | null;
    /**
     * Increment version number
     */
    private incrementVersion;
    /**
     * Validate a policy
     */
    validatePolicy(policy: unknown): PolicyValidationResult;
    /**
     * Simulate policy evaluation (dry-run)
     */
    simulate(request: PolicySimulationRequest): Promise<PolicySimulationResult>;
    /**
     * Register an update listener
     */
    onPolicyUpdate(listener: PolicyUpdateListener): () => void;
    /**
     * Notify listeners of policy updates
     */
    private notifyListeners;
    /**
     * Register a custom condition expression evaluator
     */
    registerConditionEvaluator(language: string, evaluator: CustomExpressionEvaluator): void;
    /**
     * Register a custom rule handler
     */
    registerRuleHandler(name: string, handler: CustomRuleHandler): void;
    /**
     * Set rate limiter
     */
    setRateLimiter(rateLimiter: RateLimiter): void;
    /**
     * Set geo location provider
     */
    setGeoLocationProvider(provider: GeoLocationProvider): void;
    /**
     * Set break-glass validator
     */
    setBreakGlassValidator(validator: BreakGlassValidator): void;
    /**
     * Get engine statistics
     */
    getStats(): {
        totalPolicies: number;
        enabledPolicies: number;
        totalVersions: number;
        policiesByTag: Record<string, number>;
    };
    /**
     * Clear all policies
     */
    clear(): void;
}
/**
 * Create a security policy engine instance
 */
export declare function createSecurityPolicyEngine(options?: SecurityPolicyEngineOptions): SecurityPolicyEngine;
//# sourceMappingURL=engine.d.ts.map