#!/usr/bin/env bash
# ================================================================
# TEST - Umgebungsvariablen Setup
# ================================================================
# Dieses Skript muss gesourct werden: source bin/setenv.sh
# ================================================================

echo "Setting up environment variables for TEST ..."

# Basis-Projektpfad (uebergeordnetes Verzeichnis von bin/)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DXFMAKRO="$(cd "$SCRIPT_DIR/.." && pwd)"

# Pfade fuer verschiedene Komponenten
export DXFM_BIN="$DXFMAKRO/bin"
export DXFM_LIB="$DXFMAKRO/lib"
export DXFM_DATA="$DXFMAKRO/data"
export DXFM_CFG="$DXFMAKRO/cfg"
export DXFM_LOG="$DXFMAKRO/log"
export DXFM_TESTS="$DXFMAKRO/tests"
export DXFM_RESULTS="$DXFMAKRO/results"
export DXFM_EXAMPLES="$DXFMAKRO/examples"

# Python-Pfad erweitern (nur wenn noch nicht vorhanden)
if [[ ":$PYTHONPATH:" != *":$DXFM_LIB:"* ]]; then
    export PYTHONPATH="$DXFM_LIB:$PYTHONPATH"
fi

# Ordner erstellen falls sie nicht existieren
mkdir -p "$DXFM_BIN" "$DXFM_CFG" "$DXFM_LIB" "$DXFM_DATA" "$DXFM_LOG" "$DXFM_RESULTS" "$DXFM_EXAMPLES"

echo ""
echo "================================================================"
echo "TEST ENVIRONMENT SETUP COMPLETE"
echo "================================================================"
echo "DXFMAKRO         = $DXFMAKRO"
echo "DXFM_BIN          = $DXFM_BIN"
echo "DXFM_CFG          = $DXFM_CFG"
echo "DXFM_LIB          = $DXFM_LIB"
echo "DXFM_DATA         = $DXFM_DATA"
echo "DXFM_RESULTS      = $DXFM_RESULTS"
echo "DXFM_LOG          = $DXFM_LOG"
echo "DXFM_EXAMPLES     = $DXFM_EXAMPLES"
echo "PYTHONPATH      = $PYTHONPATH"
echo "================================================================"
echo ""
