#!/bin/bash
# Script to add Git submodules to The Order monorepo
# Replace URLs with your actual repository URLs

set -e

echo "Adding Git submodules to The Order monorepo..."

# Apps
echo "Adding app submodules..."
git submodule add https://github.com/the-order/portal-public.git apps/portal-public || echo "portal-public already exists or URL incorrect"
git submodule add https://github.com/the-order/portal-internal.git apps/portal-internal || echo "portal-internal already exists or URL incorrect"
git submodule add https://github.com/the-order/mcp-members.git apps/mcp-members || echo "mcp-members already exists or URL incorrect"
git submodule add https://github.com/the-order/mcp-legal.git apps/mcp-legal || echo "mcp-legal already exists or URL incorrect"

# Services
echo "Adding service submodules..."
git submodule add https://github.com/the-order/intake.git services/intake || echo "intake already exists or URL incorrect"
git submodule add https://github.com/the-order/identity.git services/identity || echo "identity already exists or URL incorrect"
git submodule add https://github.com/the-order/finance.git services/finance || echo "finance already exists or URL incorrect"
git submodule add https://github.com/the-order/dataroom.git services/dataroom || echo "dataroom already exists or URL incorrect"
git submodule add https://github.com/the-order/omnis-brand.git services/omnis-brand || echo "omnis-brand already exists or URL incorrect"
git submodule add https://github.com/the-order/arromis-brand.git services/arromis-brand || echo "arromis-brand already exists or URL incorrect"

# Initialize and update submodules
echo "Initializing submodules..."
git submodule update --init --recursive

echo "Submodules added successfully!"
echo ""
echo "To update submodules later, run:"
echo "  git submodule update --remote"
echo ""
echo "To clone this repo with submodules, run:"
echo "  git clone --recurse-submodules <repo-url>"

