#\!/bin/bash

# MPC System Real Scenario Verification Script
set -e

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'

ACCOUNT_SERVICE_URL="http://localhost:4000"
SESSION_COORDINATOR_URL="http://localhost:8081"
SERVER_PARTY_API_URL="http://localhost:8083"

echo -e "====================================="
echo -e "   MPC System Real Scenario Test"
echo -e "====================================="
echo ""

# Step 1: Health checks
echo -e "Step 1: Health Checks"
echo -n "  Checking account-service... "
if curl -sf /health > /dev/null; then
    echo -e "✓"
else
    echo -e "✗ Failed"
    exit 1
fi

echo -n "  Checking session-coordinator... "
if curl -sf /health > /dev/null; then
    echo -e "✓"
else
    echo -e "✗ Failed"
    exit 1
fi

echo -n "  Checking server-party-api... "
if curl -sf /health > /dev/null; then
    echo -e "✓"
else
    echo -e "✗ Failed"
    exit 1
fi

echo ""

# Step 2: Create Keygen Session
echo -e "Step 2: Create Keygen Session"

KEYGEN_RESPONSE=

echo "  Response:"
echo "" | jq '.'

SESSION_ID=

if [ "" == "null" ] || [ -z "" ]; then
    echo -e "✗ Failed to create session"
    echo "Response was: "
    exit 1
fi

echo -e "  ✓ Session created: "
echo ""

echo -e "====================================="
echo -e "✓ Basic MPC flow working\!"
echo -e "====================================="
