#!/bin/bash

# VALID_BUG_TYPES = [
#         'error',           # Replace values with ERROR
#         'merge_rows',      # Merge two rows with '&&'
#         'rotate_columns',  # Rotate each column i by i positions
#         'rotate_rows',     # Rotate each row i by i positions
#         'add_end_row',     # Add random values at the end of rows
#         'add_end_column',  # Add random values at the end of columns
#         'null'             # Replace values with NULL/None
#     ]

# Default configuration
if [ "$#" -eq 0 ]; then
    echo "Usage:"
    echo "1. Use preset configuration: bash run.sh --upper or bash run.sh --lower"
    echo "2. Custom parameters: bash run.sh [any parameters supported by generate_data.py]"
    exit 1
fi

case "$1" in
    --upper)
        # High difficulty group (accuracy 0-20%) - using bug types with low accuracy, smaller row range and higher error rate
        echo "Generating high difficulty dataset (expected accuracy 0-20%)..."
        python3 games/tasks/buggy_tables/scripts/game_of_buggy_tables.py \
          --num_of_data 10 \
          --num_rows_range 45 65 \
          --bug_rate_range 0.25 0.35 \
          --output_name "high_difficulty"
        ;;
    --lower)
        # Normal difficulty group - mixing various bug types
        echo "Generating normal difficulty dataset..."
        python3 games/tasks/buggy_tables/scripts/game_of_buggy_tables.py \
          --num_of_data 10 \
          --num_rows_range 25 40 \
          --output_name "normal_difficulty"
        ;;
    *)
        # Custom parameter mode: directly pass all parameters to Python script
        echo "Running with custom parameters..."
        python3 games/tasks/buggy_tables/scripts/game_of_buggy_tables.py "$@"
        ;;
esac



# Example parameter combinations:
# 
# High difficulty group command:
# bash run.sh --num_of_data 10 --num_rows_range 45 65 --bug_rate_range 0.25 0.35 --output_name high_difficulty
#
# Normal difficulty group command:
# bash run.sh --num_of_data 10 --num_rows_range 25 40 --output_name normal_difficulty
#
# Other custom examples:
# bash run.sh --num_of_data 20 --bug_types error null rotate_rows --bug_rate_range 0.1 0.3 --bug_types_ratio "error:3,null:2,rotate_rows:1"
# bash run.sh --num_of_data 10 --bug_types rotate_rows
# bash run.sh --num_of_data 10 --bug_types rotate_columns --num_rows_range 15 30
# bash run.sh --num_of_data 10 --bug_types add_end_row
# bash run.sh --num_of_data 10 --bug_types add_end_column
# bash run.sh --num_of_data 10 --bug_types null
# bash run.sh --num_of_data 10 --bug_types error
# bash run.sh --num_of_data 10 --bug_types merge_rows
