#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
REPORT_DIR="${1:-$ROOT_DIR/reports/tdc114plus/$(date +%Y%m%d-%H%M%S)}"
REPORT_FILE="$REPORT_DIR/release-report.md"

mkdir -p "$REPORT_DIR"

{
  echo "# tdc114plus release report"
  echo
  echo "Generated at: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
  echo
  echo "## Git"
  echo
  echo '```text'
  git -C "$ROOT_DIR" status --short --branch
  echo
  git -C "$ROOT_DIR" log --oneline -n 10
  echo '```'
  echo
  echo "## Verification Checklist"
  echo
  echo "- [ ] ./scripts/format-dart.sh"
  echo "- [ ] ./scripts/quality-gate.sh"
  echo "- [ ] Android debug APK build"
  echo "- [ ] Login/search/detail/favorites smoke test"
  echo "- [ ] Token storage review"
  echo "- [ ] Personal data exposure review"
} >"$REPORT_FILE"

echo "generated release report: $REPORT_FILE"
