# ==============================================================================
# WeatherDash API Endpoint Test Commands
#
# Prerequisite: Ensure your local web server is running.
# Base URL assumes https://rickweb.test:8443/weatherdash/api/weather_station/
# ==============================================================================

# ------------------------------------------------------------------------------
# 1. Locations Registry (locations.php)
# Fetches all registered weather stations, coordinates, and default station setting.
# ------------------------------------------------------------------------------
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/locations.php" | json_pp


# ------------------------------------------------------------------------------
# 2. Current Weather Conditions (current.php)
# Fetches real-time temperature, pressure, wind, and observation timestamps for a station.
# Default station ('home'):
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/current.php?station=home" | json_pp

# Specific station (e.g. 'Raleigh'):
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/current.php?station=Raleigh" | json_pp


# ------------------------------------------------------------------------------
# 3. Weather Forecast (forecast.php)
# Fetches 5-to-14 period forecast data including daily min/max temps and conditions.
# ------------------------------------------------------------------------------
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/forecast.php?station=home" | json_pp


# ------------------------------------------------------------------------------
# 4. Weather Alerts (alerts.php)
# Fetches active National Weather Service alerts or advisories for the target station zone.
# ------------------------------------------------------------------------------
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/alerts.php?station=home" | json_pp


# ------------------------------------------------------------------------------
# 5. Dedicated Rainfall Metrics (rain.php)
# Tests database aggregation for 24h, 7-day, monthly, and yearly precipitation totals.
# ------------------------------------------------------------------------------
curl -k -s "https://rickweb.test:8443/weatherdash/api/weather_station/rain.php?station=home" | json_pp


# ------------------------------------------------------------------------------
# 6. Live Weather Source Adapters Direct Diagnostics (weather.live-check.php)
# Tests live NWS and Open-Meteo API fetching and parsing without relying on MySQL caching.
# Check specific ZIP code (e.g. West End, NC 27376):
php /Users/rbutare/websites/apps/weather_station/weather/scripts/weather.live-check.php 27376

# Check all configured station ZIP codes sequentially:
php /Users/rbutare/websites/apps/weather_station/weather/scripts/weather.live-check.php
