#!/bin/bash

# ThrillWiki Public API Endpoint Testing Script
# Tests only endpoints that work without authentication
# Base URL: http://127.0.0.1:8000

BASE_URL="http://127.0.0.1:8000"

echo "=== TESTING PUBLIC API ENDPOINTS ==="

echo -e "\n=== HEALTH CHECKS ==="
echo "GET /api/v1/health/"
curl -s "$BASE_URL/api/v1/health/"
echo -e "\n\nGET /api/v1/health/simple/"
curl -s "$BASE_URL/api/v1/health/simple/"
echo -e "\n\nGET /api/v1/health/performance/"
curl -s "$BASE_URL/api/v1/health/performance/"

echo -e "\n\n=== API DOCUMENTATION ==="
echo "GET /api/schema/ (truncated)"
curl -s "$BASE_URL/api/schema/" | head -20
echo "... [truncated]"

echo -e "\n\n=== PARKS API ==="
echo "GET /api/v1/parks/"
curl -s "$BASE_URL/api/v1/parks/"
echo -e "\n\nGET /api/v1/parks/filter-options/"
curl -s "$BASE_URL/api/v1/parks/filter-options/"

echo -e "\n\n=== RIDES API ==="
echo "GET /api/v1/rides/"
curl -s "$BASE_URL/api/v1/rides/"
echo -e "\n\nGET /api/v1/rides/filter-options/"
curl -s "$BASE_URL/api/v1/rides/filter-options/"

echo -e "\n\n=== STATISTICS ==="
echo "GET /api/v1/stats/"
curl -s "$BASE_URL/api/v1/stats/"

echo -e "\n\n=== TRENDING & NEW CONTENT ==="
echo "GET /api/v1/trending/"
curl -s "$BASE_URL/api/v1/trending/"
echo -e "\n\nGET /api/v1/new-content/"
curl -s "$BASE_URL/api/v1/new-content/"

echo -e "\n\n=== REVIEWS ==="
echo "GET /api/v1/reviews/latest/"
curl -s "$BASE_URL/api/v1/reviews/latest/"

echo -e "\n\n=== MAPS ==="
echo "GET /api/v1/maps/locations/"
curl -s "$BASE_URL/api/v1/maps/locations/"
echo -e "\n\nGET /api/v1/maps/stats/"
curl -s "$BASE_URL/api/v1/maps/stats/"

echo -e "\n\n=== CORE SEARCH & ENTITIES ==="
echo "GET /api/v1/core/entities/suggestions/"
curl -s "$BASE_URL/api/v1/core/entities/suggestions/"

echo -e "\n\n=== RANKINGS ==="
echo "GET /api/v1/rankings/"
curl -s "$BASE_URL/api/v1/rankings/"

echo -e "\n\n=== Testing completed ==="