#!/bin/bash

# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

echo -e "${GREEN}Starting Quality Assurance Verification...${NC}"

# 1. Run Unit Tests (Pytest)
echo -e "\n${GREEN}[1/2] Running Unit Tests (backend/tests/)...${NC}"
pytest backend/tests/test_bands.py backend/tests/test_shows.py
if [ $? -eq 0 ]; then
    echo -e "${GREEN}✅ Unit Tests Passed${NC}"
else
    echo -e "${RED}❌ Unit Tests Failed${NC}"
    exit 1
fi

# 2. Run Verification Script (Notifications)
echo -e "\n${GREEN}[2/2] Running Notification Verification Script...${NC}"
# Use the backend database explicitly
export DATABASE_URL="sqlite:////Users/ten/DEV/fediversion/backend/database.db"
python3 backend/scripts/verify_notifications.py
if [ $? -eq 0 ]; then
    echo -e "${GREEN}✅ Notification Verification Passed${NC}"
else
    echo -e "${RED}❌ Notification Verification Failed${NC}"
    exit 1
fi

echo -e "\n${GREEN}🎉 All Verifications Passed!${NC}"
