#!/bin/bash

# Check if all arguments are provided
if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <iterations> <wait-min> [suspend|resume]"
    exit 1
fi

# Assign arguments to variables
iterations=$1
wait=$2
operation=$3

# Loop and call the python script
for ((i=1; i<=iterations; i++))
do
    project_name=$(printf "%s%02d" "$TIDB_PROJECT_PREFIX" "$i")
    echo "suspend/resume ${project_name} cluster ..."
    python src/suspend_cluster.py $project_name $operation

    sleep "$((wait * 60))"

done