#!/bin/bash

# Test direct de la Lambda
echo "🧪 Test direct de la Lambda..."

# Configuration
LAMBDA_URL="https://0rryyjj6vh.execute-api.eu-west-3.amazonaws.com/default/api/contrats/recgRcpVvsZgKYAyO"
TOKEN="patPt20DBCYkQJp2r.69126ad7bf59cf77d75a21dffb01a2af3f3741d56e24d901f2d7cef4ac2ae2fb"
COMPANY_NAME="Compagnie Krapo Roy"
COMPANY_B64=$(echo -n "$COMPANY_NAME" | base64)

echo "URL: $LAMBDA_URL"
echo "Company: $COMPANY_NAME"
echo "Company B64: $COMPANY_B64"
echo ""

# Test 1: Récupérer le contrat
echo "=== TEST 1: Récupération du contrat ==="
curl -v \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-company-name: $COMPANY_NAME" \
  -H "x-company-name-b64: $COMPANY_B64" \
  "$LAMBDA_URL"

echo -e "\n\n"

# Test 2: Récupérer les paies
echo "=== TEST 2: Récupération des paies ==="
curl -v \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-company-name: $COMPANY_NAME" \
  -H "x-company-name-b64: $COMPANY_B64" \
  "${LAMBDA_URL}/paies?regime=CDDU_MULTI"

echo -e "\n\nTest terminé!"
