#!/bin/bash

# Test script for LLM Proxy Dashboard

echo "Building LLM Proxy Gateway..."
cargo build --release

echo ""
echo "Starting server in background..."
./target/release/llm-proxy &
SERVER_PID=$!

# Wait for server to start
sleep 3

echo ""
echo "Testing dashboard endpoints..."

# Test health endpoint
echo "1. Testing health endpoint:"
curl -s http://localhost:8080/health

echo ""
echo "2. Testing dashboard static files:"
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/

echo ""
echo "3. Testing API endpoints:"
curl -s http://localhost:8080/api/auth/status | jq . 2>/dev/null || echo "JSON response received"

echo ""
echo "Dashboard should be available at: http://localhost:8080"
echo "Default login: admin / admin"
echo ""
echo "Press Ctrl+C to stop the server"

# Keep script running
wait $SERVER_PID