// Test different API Gateway patterns
console.log("🧪 Testing different API patterns...");

const patterns = [
  // Pattern 1: Sans /api
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/default/contrats",
  
  // Pattern 2: Avec /v1
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/default/v1/contrats", 
  
  // Pattern 3: Stage différent
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/prod/api/contrats",
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/dev/api/contrats",
  
  // Pattern 4: Sans stage
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/api/contrats",
  
  // Pattern 5: URL racine
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/default",
  "https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/"
];

const headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer patPt20DBCYkQJp2r.69126ad7bf59cf77d75a21dffb01a2af3f3741d56e24d901f2d7cef4ac2ae2fb',
  'x-company-name': 'Compagnie Krapo Roy',
  'x-company-name-b64': 'Q29tcGFnbmllIEtyYXBvIFJveQ=='
};

for (const url of patterns) {
  console.log(`\n🔍 Testing: ${url}`);
  
  try {
    const response = await fetch(url, { headers });
    console.log(`   Status: ${response.status} ${response.statusText}`);
    
    if (response.status !== 404) {
      const text = await response.text();
      console.log(`   Response: ${text.substring(0, 200)}${text.length > 200 ? '...' : ''}`);
    }
  } catch (error) {
    console.log(`   Error: ${error.message}`);
  }
}

console.log("\n✅ Test completed!");
