#!/bin/bash

# Deploy test files to staging
echo "Deploying test files to staging..."

# Configuration
STAGING_HOST="wordpress-974670-5399585.cloudwaysapps.com"
SSH_USER="master"
STAGING_PATH="/home/master/applications/uqlfiqglqg/public_html"
LOCAL_PATH="/Users/ben/dev/upskill-event-manager/wordpress-dev"

# Deploy test setup script
echo "Deploying setup-test-events.php..."
scp $LOCAL_PATH/tests/setup-test-events.php $SSH_USER@$STAGING_HOST:$STAGING_PATH/wp-content/plugins/hvac-community-events/tests/

if [ $? -ne 0 ]; then
    echo "Error: Failed to deploy test setup script."
    exit 1
fi

echo "Test files deployed successfully!"

# Run the test setup script
echo "Running test data setup..."
ssh $SSH_USER@$STAGING_HOST "cd $STAGING_PATH && wp eval-file wp-content/plugins/hvac-community-events/tests/setup-test-events.php"

if [ $? -ne 0 ]; then
    echo "Error: Failed to run test setup script."
    exit 1
fi

echo "Test data setup complete!"