/**
 * Template Sync Service
 *
 * Synchronizes templates across servers with drift detection
 * and compliance reporting.
 *
 * @since v1.69.5
 */
import type { ConfigTemplate, TemplateVariableValues } from './template-types.js';
/**
 * Server configuration for sync
 */
export interface SyncServer {
    id: string;
    name: string;
    path: string;
    templateId?: string;
    variables?: TemplateVariableValues;
    lastSync?: string;
    status: 'synced' | 'drifted' | 'unknown' | 'error';
}
/**
 * Drift detection result
 */
export interface DriftResult {
    serverId: string;
    templateId: string;
    hasDrift: boolean;
    driftedFiles: DriftedFile[];
    checkedAt: string;
}
/**
 * Drifted file details
 */
export interface DriftedFile {
    path: string;
    expected: string;
    actual: string;
    differences: Array<{
        line: number;
        expected: string;
        actual: string;
    }>;
}
/**
 * Compliance report
 */
export interface ComplianceReport {
    generatedAt: string;
    servers: ServerCompliance[];
    summary: {
        total: number;
        compliant: number;
        drifted: number;
        unknown: number;
        error: number;
    };
}
/**
 * Server compliance status
 */
export interface ServerCompliance {
    server: SyncServer;
    compliant: boolean;
    drift?: DriftResult;
    lastChecked: string;
}
/**
 * Sync schedule
 */
export interface SyncSchedule {
    id: string;
    name: string;
    templateId: string;
    serverIds: string[];
    cron?: string;
    interval?: number;
    enabled: boolean;
    lastRun?: string;
    nextRun?: string;
}
/**
 * Webhook configuration
 */
export interface SyncWebhook {
    id: string;
    url: string;
    events: Array<'sync_complete' | 'drift_detected' | 'sync_failed'>;
    secret?: string;
    enabled: boolean;
}
/**
 * Sync result
 */
export interface SyncResult {
    success: boolean;
    serverId: string;
    templateId: string;
    syncedFiles: string[];
    errors: string[];
    startedAt: string;
    completedAt: string;
}
/**
 * Template sync service
 */
export declare class TemplateSyncService {
    private servers;
    private templates;
    private serverFiles;
    private schedules;
    private webhooks;
    private syncHistory;
    private engine;
    constructor();
    /**
     * Register a server for sync
     */
    registerServer(server: SyncServer): void;
    /**
     * Get server
     */
    getServer(id: string): SyncServer | undefined;
    /**
     * Get all servers
     */
    getServers(): SyncServer[];
    /**
     * Remove server
     */
    removeServer(id: string): boolean;
    /**
     * Set server file content (for drift detection)
     */
    setServerFile(serverId: string, path: string, content: string): void;
    /**
     * Get server file content
     */
    getServerFile(serverId: string, path: string): string | undefined;
    /**
     * Register template
     */
    registerTemplate(template: ConfigTemplate): void;
    /**
     * Get template
     */
    getTemplate(id: string): ConfigTemplate | undefined;
    /**
     * Check for drift on a server
     */
    checkDrift(serverId: string): DriftResult | null;
    /**
     * Check drift for all servers
     */
    checkAllDrift(): Map<string, DriftResult | null>;
    /**
     * Generate compliance report
     */
    generateComplianceReport(): ComplianceReport;
    /**
     * Sync template to server
     * Note: Actual file writing should be done by caller
     */
    sync(serverId: string, templateId: string, variables: TemplateVariableValues): SyncResult;
    /**
     * Sync to multiple servers
     */
    syncMultiple(serverIds: string[], templateId: string, variables: TemplateVariableValues): SyncResult[];
    /**
     * Get sync history
     */
    getSyncHistory(limit?: number): SyncResult[];
    /**
     * Get sync history for server
     */
    getServerSyncHistory(serverId: string): SyncResult[];
    /**
     * Create sync schedule
     */
    createSchedule(schedule: SyncSchedule): void;
    /**
     * Get schedule
     */
    getSchedule(id: string): SyncSchedule | undefined;
    /**
     * Get all schedules
     */
    getSchedules(): SyncSchedule[];
    /**
     * Delete schedule
     */
    deleteSchedule(id: string): boolean;
    /**
     * Enable/disable schedule
     */
    setScheduleEnabled(id: string, enabled: boolean): boolean;
    /**
     * Get due schedules
     */
    getDueSchedules(): SyncSchedule[];
    /**
     * Run schedule
     */
    runSchedule(scheduleId: string, variables: TemplateVariableValues): SyncResult[];
    /**
     * Register webhook
     */
    registerWebhook(webhook: SyncWebhook): void;
    /**
     * Remove webhook
     */
    removeWebhook(id: string): boolean;
    /**
     * Get webhooks
     */
    getWebhooks(): SyncWebhook[];
    /**
     * Trigger webhooks for event
     * Note: Actual HTTP calls should be done by caller
     */
    triggerWebhooks(event: SyncWebhook['events'][0], data: unknown): Array<{
        webhook: SyncWebhook;
        payload: unknown;
    }>;
    /**
     * Get servers by template
     */
    getServersByTemplate(templateId: string): SyncServer[];
    /**
     * Get servers with drift
     */
    getDriftedServers(): SyncServer[];
    /**
     * Clear all data
     */
    clear(): void;
    private calculateDifferences;
    private createSyncResult;
}
/**
 * Create a new template sync service
 */
export declare function createTemplateSyncService(): TemplateSyncService;
/**
 * Get template sync service singleton
 */
export declare function getTemplateSyncService(): TemplateSyncService;
/**
 * Reset template sync service singleton
 */
export declare function resetTemplateSyncService(): void;
//# sourceMappingURL=template-sync.d.ts.map