#!/bin/bash
# Скрипт для тестирования производительности основных endpoints
# Использование: ./scripts/test_endpoints_performance.sh

echo "=================================="
echo "⚡ Тестирование производительности API"
echo "=================================="
echo ""

cd backend

# Список endpoints для тестирования
ENDPOINTS=(
    "/api/users/mentor/dashboard/"
    "/api/analytics/overview/?period=month"
    "/api/analytics/detailed_lessons/?period=month"
    "/api/analytics/comparison/?period=month"
    "/api/analytics/time_series/?period=month&group_by=day"
    "/api/analytics/revenue/?period=month"
    "/api/users/profile/me/"
    "/api/homework/homeworks/"
)

EMAIL="${1:-mentor@test.com}"
ITERATIONS="${2:-5}"

echo "📧 Email: $EMAIL"
echo "🔄 Итераций: $ITERATIONS"
echo ""

for endpoint in "${ENDPOINTS[@]}"; do
    echo "=================================="
    echo "Тестирую: $endpoint"
    echo "=================================="
    python manage.py benchmark_api \
        --endpoint "$endpoint" \
        --email "$EMAIL" \
        --iterations "$ITERATIONS"
    echo ""
done

echo "=================================="
echo "✅ Тестирование завершено"
echo "=================================="

