// Simple test script to debug the paies issue
console.log("🔍 Testing paies endpoint directly...");

const contractId = "recgRcpVvsZgKYAyO";
const testUrl = `/api/debug/paies?contractId=${contractId}`;

fetch(testUrl)
  .then(response => response.json())
  .then(data => {
    console.log("🧪 Debug response:", data);
    
    if (data.contract) {
      console.log("✅ Contract data:", {
        status: data.contract.status,
        reference: data.contract.reference,
        id: data.contract.data?.id
      });
    }
    
    if (data.paies) {
      console.log("📊 Paies response:", {
        status: data.paies.response.status,
        itemsCount: data.paies.response.data?.items?.length || 0,
        data: data.paies.response.data
      });
    }
  })
  .catch(error => {
    console.error("❌ Test failed:", error);
  });
