# KROW Workforce Project Makefile
# -------------------------------
# This is the main entry point. It includes modular Makefiles from the 'makefiles/' directory.

# The default command to run if no target is specified.
.DEFAULT_GOAL := help

# --- Include Modules ---
include makefiles/common.mk
include makefiles/web.mk
include makefiles/launchpad.mk
include makefiles/mobile.mk
include makefiles/dataconnect.mk
include makefiles/tools.mk

# --- Main Help Command ---
.PHONY: help

help:
	@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
	@echo " 🚀 KROW Workforce - Available Makefile Commands"
	@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
	@echo ""
	@echo "  📦 WEB FRONTEND (apps/web)"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make web-install          Install web frontend dependencies"
	@echo "  make web-info             List web development commands"
	@echo "  make web-dev              Start local web frontend dev server"
	@echo "  make web-build [ENV=dev]  Build web frontend for production (dev/staging)"
	@echo "  make web-lint             Run linter for web frontend"
	@echo "  make web-preview          Preview web frontend build"
	@echo "  make web-deploy [ENV=dev] Build and deploy web app (dev/staging)"
	@echo ""
	@echo "  Aliases:"
	@echo "  make install              → web-install"
	@echo "  make dev                  → web-dev"
	@echo "  make build                → web-build"
	@echo "  make deploy-app           → web-deploy"
	@echo ""
	@echo "  🏠 LAUNCHPAD (internal/launchpad)"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make launchpad-dev              Start launchpad dev server (Firebase Hosting)"
	@echo "  make deploy-launchpad-hosting   Deploy launchpad to Firebase Hosting"
	@echo ""
	@echo "  📱 MOBILE APPS (apps/mobile)"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make mobile-install                      Bootstrap mobile workspace + SDK"
	@echo "  make mobile-info                         List mobile development commands"
	@echo "  make mobile-client-dev-android [DEVICE=android]   Run client app (Android)"
	@echo "  make mobile-client-build PLATFORM=apk    Build client app (apk/ipa/etc)"
	@echo "  make mobile-staff-dev-android [DEVICE=android]    Run staff app (Android)"
	@echo "  make mobile-staff-build PLATFORM=apk     Build staff app (apk/ipa/etc)"
	@echo "  make mobile-hot-reload                   Hot reload running Flutter app"
	@echo "  make mobile-hot-restart                  Hot restart running Flutter app"
	@echo ""
	@echo "  🗄️  DATA CONNECT & BACKEND (backend/dataconnect)"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make dataconnect-init                Initialize Firebase Data Connect"
	@echo "  make dataconnect-deploy [ENV=dev]        Deploy Data Connect schemas (dev/staging)"
	@echo "  make dataconnect-sql-migrate [ENV=dev]   Apply pending SQL migrations"
	@echo "  make dataconnect-generate-sdk [ENV=dev]  Regenerate Data Connect client SDK"
	@echo "  make dataconnect-sync [ENV=dev]          Full sync: deploy + migrate + generate SDK"
	@echo "  make dataconnect-seed [ENV=dev]          Seed database with test data"
	@echo "  make dataconnect-clean [ENV=dev]         Delete all data from Data Connect"
	@echo "  make dataconnect-test [ENV=dev]          Test Data Connect deployment (dry-run)"
	@echo "  make dataconnect-enable-apis [ENV=dev]   Enable required GCP APIs"
	@echo "  make dataconnect-bootstrap-db            ONE-TIME: Full Cloud SQL + Data Connect setup (dev)"
	@echo "  make dataconnect-bootstrap-validation-database  ONE-TIME: Setup validation database"
	@echo "  make dataconnect-backup-dev-to-validation       Backup dev database to validation"
	@echo ""
	@echo "  🛠️  DEVELOPMENT TOOLS"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make install-melos        Install Melos globally (for mobile dev)"
	@echo "  make install-git-hooks    Install git pre-push hook (protect main/dev)"
	@echo "  make sync-prototypes      Sync prototypes from client-krow-poc repo"
	@echo "  make clean-branches       Delete local branches (keeps main/dev/demo/**/protected)"
	@echo ""
	@echo "  ℹ️  HELP"
	@echo "  ────────────────────────────────────────────────────────────────────"
	@echo "  make help                 Show this help message"
	@echo ""
	@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
	@echo " 💡 Tip: Run 'make mobile-install' first for mobile development"
	@echo " 💡 Tip: Use 'make dataconnect-sync' after schema changes"
	@echo " 💡 Tip: Default ENV=dev, use ENV=staging for staging environment"
	@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"