/**
 * Policy Simulator
 *
 * Simulates policy impact against historical data before activation.
 * Implements FR146-147 for Epic 4.
 *
 * Features:
 * - Run policies against historical intents
 * - Calculate impact percentages
 * - Identify affected agents
 * - Provide detailed simulation reports
 *
 * @packageDocumentation
 */
import type { ID, ControlAction } from '../../common/types.js';
import type { PolicyDefinition, PolicyEvaluationContext, PolicyEvaluationResult } from '../types.js';
/**
 * Historical intent for simulation
 */
export interface HistoricalIntent {
    id: ID;
    action: string;
    resource: string;
    category?: string;
    parameters?: Record<string, unknown>;
    entityId: ID;
    entityType: string;
    trustScore: number;
    trustLevel: number;
    originalDecision: ControlAction;
    timestamp: string;
    metadata?: Record<string, unknown>;
}
/**
 * Simulation result for a single intent
 */
export interface IntentSimulationResult {
    intentId: ID;
    originalDecision: ControlAction;
    simulatedDecision: ControlAction;
    changed: boolean;
    matchedRuleId?: string;
    matchedRuleName?: string;
    reason?: string;
}
/**
 * Impact summary by action type
 */
export interface ActionImpact {
    action: ControlAction;
    originalCount: number;
    simulatedCount: number;
    delta: number;
    deltaPercent: number;
}
/**
 * Impact by entity/agent
 */
export interface EntityImpact {
    entityId: ID;
    entityType: string;
    affectedIntents: number;
    changedDecisions: number;
    trustLevel: number;
}
/**
 * Complete simulation report
 */
export interface SimulationReport {
    /** Unique simulation ID */
    simulationId: string;
    /** Policy that was simulated */
    policyName: string;
    /** Time range of historical data */
    timeRange: {
        start: string;
        end: string;
    };
    /** Total intents evaluated */
    totalIntents: number;
    /** Intents with changed decisions */
    changedDecisions: number;
    /** Change percentage */
    changePercent: number;
    /** Impact breakdown by action type */
    actionImpact: ActionImpact[];
    /** Top affected entities */
    topAffectedEntities: EntityImpact[];
    /** Sample of changed decisions */
    sampleChanges: IntentSimulationResult[];
    /** Duration of simulation */
    durationMs: number;
    /** Timestamp */
    simulatedAt: string;
    /** Warnings or notes */
    warnings: string[];
}
/**
 * Simulation options
 */
export interface SimulationOptions {
    /** Policy to simulate */
    policy: PolicyDefinition;
    /** Policy name for reporting */
    policyName: string;
    /** Tenant ID */
    tenantId: ID;
    /** Time range for historical data (default: 30 days) */
    daysBack?: number;
    /** Maximum intents to evaluate (default: 10000) */
    maxIntents?: number;
    /** Include detailed per-intent results */
    includeDetails?: boolean;
}
/**
 * Impact analysis summary
 */
export interface ImpactAnalysis {
    /** Overall impact level */
    impactLevel: 'low' | 'medium' | 'high' | 'critical';
    /** Impact description */
    description: string;
    /** Estimated affected intents per day */
    estimatedDailyImpact: number;
    /** Key risk factors */
    riskFactors: string[];
    /** Recommendations */
    recommendations: string[];
    /** Requires confirmation before activation? */
    requiresConfirmation: boolean;
}
/**
 * Policy Simulator Service
 *
 * Simulates policy effects against historical intent data.
 */
export declare class PolicySimulator {
    private evaluator;
    constructor(evaluator?: PolicyEvaluator);
    /**
     * Run a policy simulation against historical data
     */
    simulate(options: SimulationOptions, historicalData: HistoricalIntent[]): Promise<SimulationReport>;
    /**
     * Analyze impact and generate recommendations
     */
    analyzeImpact(report: SimulationReport): ImpactAnalysis;
    /**
     * Build evaluation context from historical intent
     */
    private buildContext;
}
interface PolicyEvaluator {
    evaluate(policy: PolicyDefinition, context: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
}
/**
 * Create a policy simulator instance
 */
export declare function createPolicySimulator(): PolicySimulator;
export {};
//# sourceMappingURL=simulator.d.ts.map