#!/usr/bin/env bash
# Generate Finanzplan Excel exports with formulas + charts.
# Step 1: TS script writes data + formulas via exceljs
# Step 2: Python script adds charts via openpyxl
#
# Requires PG_CONN env var pointing at the breakpilot_db postgres instance.
set -e
cd "$(dirname "$0")/.."
if [[ -z "${PG_CONN:-}" ]]; then
  echo "PG_CONN env var is required (postgresql://user:pass@host:port/breakpilot_db)" >&2
  exit 1
fi
npx tsx scripts/export-finanzplan-excel.ts
python3 scripts/add-charts.py
echo
echo "Done. Files in $(pwd)/exports/"
