#!/bin/bash
# moon-phase-monthly.sh — thin wrapper around moon_phase_monthly.py.
#
# Run via systemd daily.  In auto mode (no flags) the Python helper checks
# all three phases (full, first-quarter, third-quarter) and runs the composite
# for any whose post-day equals today UTC.  If you scheduled the timer for
# 09:30 local, you'll see posts hit Mattermost at:
#
#   Full Moon         3 days after exact full moon
#   First Quarter     2 days after exact first quarter (best-effort — daytime)
#   Third Quarter     2 days after exact third quarter
#
# Manual:
#   ./moon-phase-monthly.sh                                      # auto mode
#   ./moon-phase-monthly.sh --dry-run                            # auto, no post
#   ./moon-phase-monthly.sh --phase full                         # force most recent full
#   ./moon-phase-monthly.sh --phase third-quarter --target 2026-04-09T11:51:00Z

set -euo pipefail

SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "$SCRIPT_DIR/sky-cam.conf"
export TZ="$TIMEZONE"

exec python3 "$SCRIPT_DIR/moon_phase_monthly.py" "$@"
