"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SyncIntelligenceService = void 0;
const axios_1 = __importDefault(require("axios"));
class SyncIntelligenceService {
    constructor(baseURL, apiKey) {
        this.api = axios_1.default.create({
            baseURL,
            headers: {
                'Content-Type': 'application/json',
                ...(apiKey && { 'X-API-Key': apiKey }),
            },
        });
        // Add response interceptor for error handling
        this.api.interceptors.response.use((response) => response, (error) => {
            if (error.response) {
                // The request was made and the server responded with a status code
                // that falls out of the range of 2xx
                throw new Error(error.response.data.message || 'API request failed');
            }
            else if (error.request) {
                // The request was made but no response was received
                throw new Error('No response received from server');
            }
            else {
                // Something happened in setting up the request that triggered an Error
                throw new Error('Error setting up request');
            }
        });
    }
    /**
     * Get sync intelligence data for a specific configuration
     */
    async getSyncIntelligence(configId) {
        const response = await this.api.get(`/sync/intelligence/${configId}`);
        return response.data;
    }
    /**
     * Get sync predictions for a specific configuration
     */
    async getSyncPredictions(configId) {
        const response = await this.api.get(`/sync/predictions/${configId}`);
        return response.data;
    }
    /**
     * Get recommended sync schedule for a specific configuration
     */
    async getSyncSchedule(configId) {
        const response = await this.api.get(`/sync/schedule/${configId}`);
        return response.data;
    }
    /**
     * Update sync schedule for a specific configuration
     */
    async updateSyncSchedule(configId, schedule) {
        const response = await this.api.patch(`/sync/schedule/${configId}`, schedule);
        return response.data;
    }
    /**
     * Apply a healing strategy to a sync operation
     */
    async applyHealingStrategy(operationId, strategy) {
        await this.api.post(`/sync/healing/${operationId}`, strategy);
    }
    /**
     * Get historical sync patterns for analysis
     */
    async getSyncPatterns(configId, timeRange) {
        const response = await this.api.get(`/sync/patterns/${configId}`, {
            params: timeRange,
        });
        return response.data;
    }
    /**
     * Get recommended transformation rules based on sync patterns
     */
    async getRecommendedTransformations(configId) {
        const response = await this.api.get(`/sync/transformations/${configId}`);
        return response.data;
    }
    /**
     * Get validation rules based on sync patterns
     */
    async getValidationRules(configId) {
        const response = await this.api.get(`/sync/validation/${configId}`);
        return response.data;
    }
    /**
     * Get conflict resolution strategies based on sync patterns
     */
    async getConflictStrategies(configId) {
        const response = await this.api.get(`/sync/conflicts/strategies/${configId}`);
        return response.data;
    }
    /**
     * Get performance metrics and trends
     */
    async getPerformanceMetrics(configId) {
        const response = await this.api.get(`/sync/performance/${configId}`);
        return response.data;
    }
    /**
     * Get error patterns and recommendations
     */
    async getErrorPatterns(configId) {
        const response = await this.api.get(`/sync/errors/patterns/${configId}`);
        return response.data;
    }
    /**
     * Get system health status
     */
    async getSystemHealth(configId) {
        const response = await this.api.get(`/sync/health/${configId}`);
        return response.data;
    }
    /**
     * Get resource utilization metrics
     */
    async getResourceUtilization(configId) {
        const response = await this.api.get(`/sync/resources/${configId}`);
        return response.data;
    }
    /**
     * Get sync operation recommendations
     */
    async getOperationRecommendations(configId) {
        const response = await this.api.get(`/sync/recommendations/${configId}`);
        return response.data;
    }
    /**
     * Get sync operation history with analysis
     */
    async getOperationHistory(configId, options) {
        const response = await this.api.get(`/sync/history/${configId}`, {
            params: options,
        });
        return response.data;
    }
    /**
     * Get sync operation details with intelligence insights
     */
    async getOperationDetails(operationId) {
        const response = await this.api.get(`/sync/operations/${operationId}`);
        return response.data;
    }
    /**
     * Get sync configuration recommendations
     */
    async getConfigurationRecommendations(configId) {
        const response = await this.api.get(`/sync/config/recommendations/${configId}`);
        return response.data;
    }
    /**
     * Get sync endpoint health status
     */
    async getEndpointHealth(configId) {
        const response = await this.api.get(`/sync/endpoints/health/${configId}`);
        return response.data;
    }
    /**
     * Get sync data quality metrics
     */
    async getDataQualityMetrics(configId) {
        const response = await this.api.get(`/sync/quality/${configId}`);
        return response.data;
    }
    /**
     * Get sync security insights
     */
    async getSecurityInsights(configId) {
        const response = await this.api.get(`/sync/security/${configId}`);
        return response.data;
    }
    /**
     * Get sync compliance status
     */
    async getComplianceStatus(configId) {
        const response = await this.api.get(`/sync/compliance/${configId}`);
        return response.data;
    }
    /**
     * Get sync audit logs with analysis
     */
    async getAuditLogs(configId, options) {
        const response = await this.api.get(`/sync/audit/${configId}`, {
            params: options,
        });
        return response.data;
    }
}
exports.SyncIntelligenceService = SyncIntelligenceService;
//# sourceMappingURL=SyncIntelligenceService.js.map