#!/bin/bash
# Stop amar room (managed app + soleprint)
#
# Usage:
#   ./stop.sh              # Stop all
#   ./stop.sh amar         # Stop only amar
#   ./stop.sh soleprint    # Stop only soleprint

set -e
cd "$(dirname "$0")/.."

TARGET="all"
[ -n "$1" ] && TARGET="$1"

if [ "$TARGET" = "all" ] || [ "$TARGET" = "soleprint" ]; then
    echo "Stopping soleprint..."
    (cd soleprint && docker compose down)
fi

if [ "$TARGET" = "all" ] || [ "$TARGET" = "amar" ]; then
    echo "Stopping amar..."
    docker compose down
fi

echo "Done."
