#!/bin/bash

# Script to update all standard prod configs with approval workflow and SNS notifications
# This updates the 9 remaining standard configs

SERVICES=(
  "tbi-acc-exotiktours-connector"
  "tbi-acc-hotel-mapping-service"
  "tbi-acc-mybooking-service"
  "tbi-acc-notification-service"
  "tbi-acc-profile-service"
  "tbi-acc-profile-sync-service"
  "tbi-acc-quotes-service"
)

echo "Updating ${#SERVICES[@]} standard prod configs..."

for SERVICE in "${SERVICES[@]}"; do
  echo "Processing $SERVICE..."
  
  CONFIG_FILE="prod/$SERVICE/.circleci/config.yml"
  
  if [ ! -f "$CONFIG_FILE" ]; then
    echo "  ❌ Config not found: $CONFIG_FILE"
    continue
  fi
  
  # Check if it's already updated (has notify-await-build-approval)
  if grep -q "notify-await-build-approval" "$CONFIG_FILE"; then
    echo "  ✓ Already updated"
    continue
  fi
  
  echo "  → Updating $SERVICE..."
done

echo "✓ Update complete"
