/**
 * Compliance Reporter
 *
 * Generates audit reports for SOC 2 controls and compliance requirements.
 * Supports export in JSON and CSV formats for auditors.
 *
 * @packageDocumentation
 */
import type { ID, Timestamp } from '../common/types.js';
import { AuditService } from './service.js';
import { type SecurityEventCategory, type SecuritySeverity } from './security-events.js';
/**
 * SOC 2 Control mapping
 */
export interface Soc2Control {
    /** Control ID (e.g., CC6.1) */
    id: string;
    /** Control name */
    name: string;
    /** Control description */
    description: string;
    /** Trust Services Category */
    category: 'security' | 'availability' | 'processing_integrity' | 'confidentiality' | 'privacy';
    /** Related event types */
    eventTypes: string[];
}
/**
 * SOC 2 Controls mapping
 */
export declare const SOC2_CONTROLS: Record<string, Soc2Control>;
/**
 * Report filter options
 */
export interface ReportFilters {
    /** Start time for the report period */
    startTime: Timestamp;
    /** End time for the report period */
    endTime: Timestamp;
    /** Tenant ID to filter by */
    tenantId: ID;
    /** Filter by specific event types */
    eventTypes?: string[];
    /** Filter by event categories */
    categories?: SecurityEventCategory[];
    /** Filter by severities */
    severities?: SecuritySeverity[];
    /** Filter by SOC 2 control IDs */
    soc2Controls?: string[];
    /** Filter by actor IDs */
    actorIds?: string[];
    /** Filter by outcome */
    outcomes?: ('success' | 'failure' | 'blocked' | 'escalated')[];
}
/**
 * Report summary statistics
 */
export interface ReportSummary {
    /** Total number of events in the report */
    totalEvents: number;
    /** Events by category */
    byCategory: Record<string, number>;
    /** Events by severity */
    bySeverity: Record<string, number>;
    /** Events by outcome */
    byOutcome: Record<string, number>;
    /** Events by SOC 2 control */
    bySoc2Control: Record<string, number>;
    /** Events by event type (top 20) */
    topEventTypes: Array<{
        type: string;
        count: number;
    }>;
    /** Unique actors */
    uniqueActors: number;
    /** Report time range */
    timeRange: {
        start: Timestamp;
        end: Timestamp;
        durationHours: number;
    };
}
/**
 * Compliance report
 */
export interface ComplianceReport {
    /** Report metadata */
    metadata: {
        /** Report ID */
        id: string;
        /** Report generation timestamp */
        generatedAt: Timestamp;
        /** Report version */
        version: string;
        /** Filters applied */
        filters: ReportFilters;
        /** Generator information */
        generator: string;
    };
    /** Report summary */
    summary: ReportSummary;
    /** SOC 2 control coverage */
    soc2Coverage: Soc2ControlCoverage[];
    /** Detailed events (if includeEvents is true) */
    events?: AuditEventRecord[];
}
/**
 * SOC 2 control coverage in report
 */
export interface Soc2ControlCoverage {
    /** Control definition */
    control: Soc2Control;
    /** Number of events for this control */
    eventCount: number;
    /** Breakdown by outcome */
    byOutcome: Record<string, number>;
    /** Breakdown by severity */
    bySeverity: Record<string, number>;
    /** Sample events (first 5) */
    sampleEvents: AuditEventRecord[];
    /** Assessment */
    assessment: {
        /** Whether control has adequate logging */
        adequateCoverage: boolean;
        /** Coverage percentage (based on expected event types) */
        coveragePercent: number;
        /** Missing event types */
        missingEventTypes: string[];
        /** Recommendations */
        recommendations: string[];
    };
}
/**
 * Simplified audit event for reports
 */
export interface AuditEventRecord {
    /** Event ID */
    id: string;
    /** Event timestamp */
    timestamp: Timestamp;
    /** Event type */
    eventType: string;
    /** Event category */
    category: string;
    /** Event severity */
    severity: string;
    /** Actor ID */
    actorId: string;
    /** Actor type */
    actorType: string;
    /** Resource type */
    resourceType: string;
    /** Resource ID */
    resourceId: string;
    /** Action performed */
    action: string;
    /** Outcome */
    outcome: string;
    /** Reason (if failure) */
    reason?: string;
    /** Request ID */
    requestId: string;
    /** SOC 2 control */
    soc2Control?: string;
}
/**
 * Export format
 */
export type ExportFormat = 'json' | 'csv';
/**
 * Report generation options
 */
export interface ReportOptions {
    /** Include individual events in report (default: false for summary only) */
    includeEvents?: boolean;
    /** Maximum events to include (default: 10000) */
    maxEvents?: number;
    /** Export format (default: json) */
    format?: ExportFormat;
    /** Include SOC 2 control assessment (default: true) */
    includeSoc2Assessment?: boolean;
}
/**
 * Compliance Reporter
 *
 * Generates audit reports for SOC 2 controls and compliance requirements.
 */
export declare class ComplianceReporter {
    private auditService;
    constructor(auditService?: AuditService);
    /**
     * Generate a compliance report
     */
    generateReport(filters: ReportFilters, options?: ReportOptions): Promise<ComplianceReport>;
    /**
     * Export report to specified format
     */
    exportReport(report: ComplianceReport, format: ExportFormat): Promise<string>;
    /**
     * Generate report for specific SOC 2 control
     */
    generateSoc2ControlReport(controlId: string, filters: Omit<ReportFilters, 'soc2Controls'>, options?: ReportOptions): Promise<ComplianceReport>;
    /**
     * Generate summary report for all SOC 2 controls
     */
    generateSoc2SummaryReport(tenantId: ID, startTime: Timestamp, endTime: Timestamp): Promise<{
        controls: Array<{
            control: Soc2Control;
            eventCount: number;
            failureCount: number;
            coveragePercent: number;
            status: 'compliant' | 'needs_attention' | 'non_compliant';
        }>;
        overallStatus: 'compliant' | 'needs_attention' | 'non_compliant';
        recommendations: string[];
    }>;
    /**
     * Get event counts by time period
     */
    getEventTimeline(tenantId: ID, startTime: Timestamp, endTime: Timestamp, intervalHours?: number): Promise<Array<{
        periodStart: Timestamp;
        periodEnd: Timestamp;
        eventCount: number;
        byCategory: Record<string, number>;
        bySeverity: Record<string, number>;
    }>>;
    /**
     * Apply additional filters in memory
     */
    private applyFilters;
    /**
     * Build report summary
     */
    private buildSummary;
    /**
     * Build SOC 2 coverage analysis
     */
    private buildSoc2Coverage;
    /**
     * Convert audit record to event record
     */
    private toEventRecord;
    /**
     * Convert report to CSV format
     */
    private toCsv;
    /**
     * Map security category to audit category
     */
    private mapCategory;
    /**
     * Map security severity to audit severity
     */
    private mapSeverity;
    /**
     * Map security outcome to audit outcome
     */
    private mapOutcome;
}
/**
 * Create a compliance reporter instance
 */
export declare function createComplianceReporter(auditService?: AuditService): ComplianceReporter;
/**
 * Get all SOC 2 controls
 */
export declare function getSoc2Controls(): Soc2Control[];
/**
 * Get SOC 2 control by ID
 */
export declare function getSoc2Control(controlId: string): Soc2Control | undefined;
//# sourceMappingURL=compliance-reporter.d.ts.map