#!/bin/bash

set -e

MODE="${1:-check}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

if [ "$MODE" != "check" ] && [ "$MODE" != "fix" ]; then
    echo "Usage: $0 [check|fix]"
    echo "  check - Preview formatting changes without modifying files"
    echo "  fix   - Apply formatting changes to files"
    exit 1
fi

echo "=========================================="
echo "HelloTax AI Format/Lint - Mode: $MODE"
echo "=========================================="
echo ""

echo "Step 1/2: Python modules"
bash "$SCRIPT_DIR/format-lint-python.sh" "$MODE"

echo ""
echo "Step 2/2: Frontend modules"
bash "$SCRIPT_DIR/format-lint-frontend.sh" "$MODE"

echo ""
echo "=========================================="
echo "All format/lint operations complete!"
echo "=========================================="
