/**
 * Data Retention Policy Definitions
 *
 * Defines retention policies for different data types to ensure
 * GDPR compliance and proper data lifecycle management.
 *
 * @packageDocumentation
 */
import { z } from 'zod';
import type { ID } from '../../common/types.js';
/**
 * Intent status types for retention policy
 */
export type IntentStatusKey = 'approved' | 'denied' | 'failed' | 'escalated';
/**
 * Retention periods by intent status (in days)
 */
export interface IntentRetentionPeriods {
    approved: number;
    denied: number;
    failed: number;
    escalated: number;
}
/**
 * Complete retention policy configuration
 */
export interface RetentionPolicyConfig {
    /** Intent retention periods by status */
    intents: IntentRetentionPeriods;
    /** Audit log retention in days (2 years for SOC2) */
    auditLogs: number;
    /** Cryptographic proofs retention in days (7 years for legal compliance) */
    proofs: number;
    /** Session data retention in days */
    sessions: number;
    /** API key access logs retention in days */
    apiKeyLogs: number;
}
/**
 * Default retention policies
 *
 * These values are based on common compliance requirements:
 * - GDPR: Right to erasure, generally 30 days for failed/denied
 * - SOC2: Audit logs must be retained for 2 years
 * - Legal: Financial proofs often require 7-year retention
 */
export declare const DEFAULT_RETENTION_POLICIES: RetentionPolicyConfig;
/**
 * Retention policy schema for validation
 */
export declare const retentionPolicySchema: z.ZodObject<{
    intents: z.ZodObject<{
        approved: z.ZodNumber;
        denied: z.ZodNumber;
        failed: z.ZodNumber;
        escalated: z.ZodNumber;
    }, "strip", z.ZodTypeAny, {
        failed?: number;
        approved?: number;
        denied?: number;
        escalated?: number;
    }, {
        failed?: number;
        approved?: number;
        denied?: number;
        escalated?: number;
    }>;
    auditLogs: z.ZodNumber;
    proofs: z.ZodNumber;
    sessions: z.ZodNumber;
    apiKeyLogs: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
    intents?: {
        failed?: number;
        approved?: number;
        denied?: number;
        escalated?: number;
    };
    proofs?: number;
    sessions?: number;
    auditLogs?: number;
    apiKeyLogs?: number;
}, {
    intents?: {
        failed?: number;
        approved?: number;
        denied?: number;
        escalated?: number;
    };
    proofs?: number;
    sessions?: number;
    auditLogs?: number;
    apiKeyLogs?: number;
}>;
/**
 * Status of a litigation hold
 */
export type LitigationHoldStatus = 'active' | 'released';
/**
 * Type of data subject to litigation hold
 */
export type LitigationHoldDataType = 'intent' | 'audit_log' | 'proof' | 'session' | 'api_key_log' | 'all';
/**
 * Litigation hold record
 */
export interface LitigationHold {
    /** Unique hold identifier */
    id: ID;
    /** Tenant this hold applies to */
    tenantId: ID;
    /** Legal matter reference */
    matterReference: string;
    /** Description of the hold */
    description: string;
    /** Type of data held */
    dataType: LitigationHoldDataType;
    /** Specific entity IDs to hold (optional - if empty, applies to all of dataType) */
    entityIds?: ID[];
    /** Hold status */
    status: LitigationHoldStatus;
    /** Who created the hold */
    createdBy: ID;
    /** When the hold was created */
    createdAt: string;
    /** When the hold expires (optional) */
    expiresAt?: string;
    /** Who released the hold (if released) */
    releasedBy?: ID;
    /** When the hold was released */
    releasedAt?: string;
    /** Reason for release */
    releaseReason?: string;
}
/**
 * Input for creating a litigation hold
 */
export interface CreateLitigationHoldInput {
    tenantId: ID;
    matterReference: string;
    description: string;
    dataType: LitigationHoldDataType;
    entityIds?: ID[];
    createdBy: ID;
    expiresAt?: string;
}
/**
 * Input for releasing a litigation hold
 */
export interface ReleaseLitigationHoldInput {
    holdId: ID;
    tenantId: ID;
    releasedBy: ID;
    releaseReason: string;
}
/**
 * Schema for creating a litigation hold
 */
export declare const createLitigationHoldSchema: z.ZodObject<{
    matterReference: z.ZodString;
    description: z.ZodString;
    dataType: z.ZodEnum<["intent", "audit_log", "proof", "session", "api_key_log", "all"]>;
    entityIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
    expiresAt: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
    expiresAt?: string;
    description?: string;
    dataType?: "all" | "session" | "proof" | "intent" | "audit_log" | "api_key_log";
    matterReference?: string;
    entityIds?: string[];
}, {
    expiresAt?: string;
    description?: string;
    dataType?: "all" | "session" | "proof" | "intent" | "audit_log" | "api_key_log";
    matterReference?: string;
    entityIds?: string[];
}>;
/**
 * Schema for releasing a litigation hold
 */
export declare const releaseLitigationHoldSchema: z.ZodObject<{
    releaseReason: z.ZodString;
}, "strip", z.ZodTypeAny, {
    releaseReason?: string;
}, {
    releaseReason?: string;
}>;
/**
 * Data category statistics for retention report
 */
export interface DataCategoryStats {
    /** Total records in this category */
    totalRecords: number;
    /** Records eligible for deletion */
    eligibleForDeletion: number;
    /** Records protected by litigation hold */
    protectedByHold: number;
    /** Oldest record date */
    oldestRecordDate?: string;
    /** Records deleted in last run */
    deletedInLastRun: number;
    /** Records anonymized in last run */
    anonymizedInLastRun: number;
}
/**
 * Retention enforcement run result
 */
export interface RetentionEnforcementResult {
    /** Category of data processed */
    category: string;
    /** Number of records deleted */
    recordsDeleted: number;
    /** Number of records anonymized */
    recordsAnonymized: number;
    /** Number of records skipped (litigation hold) */
    recordsSkipped: number;
    /** Any errors encountered */
    errors: string[];
    /** Duration in milliseconds */
    durationMs: number;
}
/**
 * Complete retention enforcement report
 */
export interface RetentionReport {
    /** Unique report identifier */
    reportId: ID;
    /** When the report was generated */
    generatedAt: string;
    /** When enforcement started */
    enforcementStartedAt: string;
    /** When enforcement completed */
    enforcementCompletedAt: string;
    /** Total duration in milliseconds */
    totalDurationMs: number;
    /** Policy configuration used */
    policyConfig: RetentionPolicyConfig;
    /** Results by category */
    results: {
        intents: RetentionEnforcementResult;
        auditLogs: RetentionEnforcementResult;
        proofs: RetentionEnforcementResult;
        sessions: RetentionEnforcementResult;
        apiKeyLogs: RetentionEnforcementResult;
    };
    /** Overall statistics */
    summary: {
        totalRecordsProcessed: number;
        totalRecordsDeleted: number;
        totalRecordsAnonymized: number;
        totalRecordsSkipped: number;
        totalErrors: number;
    };
    /** Active litigation holds at time of enforcement */
    activeLitigationHolds: number;
    /** Whether enforcement completed successfully */
    success: boolean;
    /** Any critical errors that prevented completion */
    criticalErrors: string[];
}
/**
 * Compliance status for retention
 */
export interface RetentionComplianceStatus {
    /** Whether all policies are being enforced */
    compliant: boolean;
    /** Last successful enforcement run */
    lastEnforcementRun?: string;
    /** Next scheduled enforcement run */
    nextScheduledRun?: string;
    /** Current policy configuration */
    policyConfig: RetentionPolicyConfig;
    /** Categories with overdue data */
    overdueCategories: Array<{
        category: string;
        oldestRecordDate: string;
        retentionPeriodDays: number;
        daysOverdue: number;
        recordCount: number;
    }>;
    /** Active litigation holds */
    activeLitigationHolds: LitigationHold[];
    /** Last enforcement report summary */
    lastReportSummary?: {
        reportId: ID;
        generatedAt: string;
        totalDeleted: number;
        totalAnonymized: number;
        success: boolean;
    };
}
/**
 * Get the retention period for a specific intent status
 */
export declare function getIntentRetentionPeriod(status: string, config?: RetentionPolicyConfig): number;
/**
 * Calculate the cutoff date for retention
 */
export declare function getRetentionCutoffDate(retentionDays: number): Date;
/**
 * Check if a date is past the retention period
 */
export declare function isPastRetention(recordDate: Date | string, retentionDays: number): boolean;
/**
 * Merge custom retention policies with defaults
 */
export declare function mergeRetentionPolicies(custom: Partial<RetentionPolicyConfig>): RetentionPolicyConfig;
//# sourceMappingURL=retention-policy.d.ts.map