"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadRoutes = uploadRoutes;
const axios_1 = __importDefault(require("axios"));
/**
 * Upload routes to APIForge server
 */
async function uploadRoutes(routes, options) {
    const url = options.apiForgeUrl || process.env.APIFORGE_URL || 'http://localhost:3000';
    try {
        const response = await axios_1.default.post(`${url}/api/upload-routes`, {
            projectName: options.projectName,
            routes,
            baseUrl: options.baseUrl,
            framework: 'Express',
        }, {
            headers: {
                'Content-Type': 'application/json',
                'X-API-Key': options.apiKey,
            },
            timeout: 30000,
        });
        console.log('✅ Uploaded to APIForge:', response.data);
    }
    catch (error) {
        console.error('❌ Upload failed:', error.message);
        throw error;
    }
}
