import type { ID, Timestamp } from '../../common/types.js';
import { type ExportFormat } from './report-generator.js';
/**
 * Export schedule frequency
 */
export type ExportFrequency = 'daily' | 'weekly' | 'monthly';
/**
 * Day of week for weekly schedules
 */
export type DayOfWeek = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
/**
 * S3 destination configuration
 */
export interface S3Destination {
    type: 's3';
    bucket: string;
    region: string;
    prefix?: string;
    accessKeyId?: string;
    secretAccessKey?: string;
    roleArn?: string;
    kmsKeyId?: string;
}
/**
 * Email destination configuration
 */
export interface EmailDestination {
    type: 'email';
    recipients: string[];
    cc?: string[];
    bcc?: string[];
    subject?: string;
    includeReport?: boolean;
    smtpConfig?: {
        host: string;
        port: number;
        secure: boolean;
        auth: {
            user: string;
            pass: string;
        };
    };
}
/**
 * Webhook destination configuration
 */
export interface WebhookDestination {
    type: 'webhook';
    url: string;
    method?: 'POST' | 'PUT';
    headers?: Record<string, string>;
    includeReport?: boolean;
    timeout?: number;
}
/**
 * Export destination
 */
export type ExportDestination = S3Destination | EmailDestination | WebhookDestination;
/**
 * Export schedule configuration
 */
export interface ExportSchedule {
    /** Unique schedule ID */
    id: string;
    /** Tenant ID */
    tenantId: ID;
    /** Schedule name */
    name: string;
    /** Description */
    description?: string;
    /** Whether schedule is enabled */
    enabled: boolean;
    /** Export frequency */
    frequency: ExportFrequency;
    /** Day of week for weekly exports (0 = Sunday) */
    dayOfWeek?: DayOfWeek;
    /** Day of month for monthly exports (1-28) */
    dayOfMonth?: number;
    /** Hour of day to run (0-23, UTC) */
    hourUtc: number;
    /** Minute of hour (0-59) */
    minuteUtc: number;
    /** Export format */
    format: ExportFormat;
    /** Include raw payloads */
    includePayloads: boolean;
    /** Include tamper evidence */
    includeTamperEvidence: boolean;
    /** Event types to include */
    eventTypes?: string[];
    /** Export destinations */
    destinations: ExportDestination[];
    /** Created timestamp */
    createdAt: Timestamp;
    /** Updated timestamp */
    updatedAt: Timestamp;
    /** Last run timestamp */
    lastRunAt?: Timestamp;
    /** Next scheduled run */
    nextRunAt: Timestamp;
}
/**
 * Scheduled export job record
 */
export interface ScheduledExportJob {
    /** Job ID */
    id: string;
    /** Schedule ID */
    scheduleId: string;
    /** Tenant ID */
    tenantId: ID;
    /** Job status */
    status: 'pending' | 'running' | 'completed' | 'failed';
    /** Start time */
    startedAt?: Timestamp;
    /** End time */
    completedAt?: Timestamp;
    /** Report period start */
    periodStart: Timestamp;
    /** Report period end */
    periodEnd: Timestamp;
    /** Delivery results */
    deliveryResults: ExportDeliveryResult[];
    /** Error message if failed */
    error?: string;
}
/**
 * Result of delivering export to a destination
 */
export interface ExportDeliveryResult {
    /** Destination type */
    destinationType: 's3' | 'email' | 'webhook';
    /** Destination identifier */
    destinationId: string;
    /** Success status */
    success: boolean;
    /** Delivery timestamp */
    deliveredAt?: Timestamp;
    /** Error message if failed */
    error?: string;
    /** Additional details */
    details?: Record<string, unknown>;
}
/**
 * Configuration for scheduled export manager
 */
export interface ScheduledExportConfig {
    /** Check interval for scheduled jobs (ms) */
    checkIntervalMs?: number;
    /** Max concurrent exports */
    maxConcurrentExports?: number;
    /** Retry attempts for failed deliveries */
    retryAttempts?: number;
    /** Retry delay (ms) */
    retryDelayMs?: number;
}
/**
 * Manages scheduled compliance evidence exports
 */
export declare class ScheduledExportManager {
    private config;
    private schedules;
    private jobs;
    private checkTimer;
    private running;
    private activeExports;
    private evidenceCollector;
    private hashVerifier;
    private reportGenerator;
    constructor(config?: ScheduledExportConfig);
    /**
     * Create a new export schedule
     */
    createSchedule(tenantId: ID, config: Omit<ExportSchedule, 'id' | 'createdAt' | 'updatedAt' | 'nextRunAt'>): ExportSchedule;
    /**
     * Update an export schedule
     */
    updateSchedule(scheduleId: string, updates: Partial<Omit<ExportSchedule, 'id' | 'tenantId' | 'createdAt'>>): ExportSchedule | undefined;
    /**
     * Delete an export schedule
     */
    deleteSchedule(scheduleId: string): boolean;
    /**
     * Get a schedule by ID
     */
    getSchedule(scheduleId: string): ExportSchedule | undefined;
    /**
     * List schedules for a tenant
     */
    listSchedules(tenantId: ID): ExportSchedule[];
    /**
     * Calculate the next run time for a schedule
     */
    private calculateNextRun;
    /**
     * Start the scheduler
     */
    start(): void;
    /**
     * Stop the scheduler
     */
    stop(): void;
    /**
     * Check for schedules that need to run
     */
    private checkSchedules;
    /**
     * Run a scheduled export
     */
    private runScheduledExport;
    /**
     * Deliver report to a destination
     */
    private deliverToDestination;
    /**
     * Deliver to S3 bucket
     */
    private deliverToS3;
    /**
     * Deliver via email
     */
    private deliverToEmail;
    /**
     * Deliver via webhook
     */
    private deliverToWebhook;
    /**
     * Get a job by ID
     */
    getJob(jobId: string): ScheduledExportJob | undefined;
    /**
     * List jobs for a schedule
     */
    listJobsForSchedule(scheduleId: string): ScheduledExportJob[];
    /**
     * Manually trigger a scheduled export
     */
    triggerExport(scheduleId: string): Promise<ScheduledExportJob | undefined>;
}
/**
 * Get the singleton scheduled export manager instance
 */
export declare function getScheduledExportManager(config?: ScheduledExportConfig): ScheduledExportManager;
/**
 * Reset the singleton (for testing)
 */
export declare function resetScheduledExportManager(): void;
//# sourceMappingURL=scheduled-exports.d.ts.map