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

ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PID_FILE="$ROOT_DIR/.tdc114plus-mock-server.pid"

case "${1:-}" in
  start)
    echo "mock-server scaffold: no mock API server has been implemented yet." >&2
    echo "Expected future command: start a local API-compatible mock server." >&2
    exit 2
    ;;
  stop)
    if [ -f "$PID_FILE" ]; then
      echo "mock-server scaffold: removing stale pid file $PID_FILE"
      rm -f "$PID_FILE"
    else
      echo "mock-server scaffold: no running mock server pid file found."
    fi
    ;;
  status)
    if [ -f "$PID_FILE" ]; then
      echo "mock-server scaffold: pid file exists at $PID_FILE"
    else
      echo "mock-server scaffold: not running."
    fi
    ;;
  *)
    echo "Usage: $0 {start|stop|status}" >&2
    exit 64
    ;;
esac
