#!/usr/bin/env bash
# Common path definitions for scripts
# Usage: source "$SCRIPT_DIR/lib/common/paths.sh"

# Get script directory (works even when sourced)
if [ -z "${SCRIPT_DIR:-}" ]; then
    SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-}")" && pwd)"
    # If sourced from another script, try to get the calling script's directory
    if [ "${BASH_SOURCE[0]:-}" = "${BASH_SOURCE[1]:-}" ]; then
        SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[1]:-}")" && pwd)"
    fi
fi

# Project root (two levels up from scripts/)
if [ -z "${PROJECT_ROOT:-}" ]; then
    PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
fi

# Common directories
readonly CONFIG_DIR="${PROJECT_ROOT}/config"
readonly KEYS_DIR="${PROJECT_ROOT}/keys"
readonly SCRIPTS_DIR="${PROJECT_ROOT}/scripts"
readonly TERRAFORM_DIR="${PROJECT_ROOT}/terraform"
readonly DOCS_DIR="${PROJECT_ROOT}/docs"

