#!/usr/bin/env bash
set -euo pipefail

if [ ! -d "./evibes" ]; then
  printf "\e[31m❌  Please run this script from the project's root (where the 'evibes' directory lives).\e[0m\n"
  exit 1
fi

PURPLE="\e[38;2;121;101;209m"
RESET="\e[0m"
GRAY="\e[90m"
CYAN="\e[36m"
RED="\e[31m"

SOURCE="${BASH_SOURCE[0]:-$0}"
SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
ART_PATH="$SCRIPT_DIR/../ASCII_ART_EVIBES"

if [ ! -f "$ART_PATH" ]; then
  printf "%b❌  Could not find ASCII art at %s%b\n" "$RED" "$ART_PATH" "$RESET"
  exit 1
fi

while IFS= read -r line; do
  printf "%b%s%b\n" "$PURPLE" "$line" "$RESET"
done < "$ART_PATH"

printf "\n%b                                                                       by WISELESS TEAM%b\n\n" "$GRAY" "$RESET"

printf "%bKilling services…%b\n" "$CYAN" "$RESET"
docker compose down

printf "%bCleaning up Docker data…%b\n" "$CYAN" "$RESET"
docker system prune -f

printf "%bRemoving related files…%b\n" "$CYAN" "$RESET"
rm -rf ./services_data ./media ./static

printf "%bBye-bye, hope you return later!%b\n" "$RED" "$RESET"
