(ns auto-ap.routes.health
  (:require [mount.core :as mount]))

(def running? (atom false))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(mount/defstate manage-running?
  :start (reset! running? true)
  :stop (reset! running? false))

(defn health-check [request]
  (if @running?
    {:status 200
     :body   "Ok"}
    {:status 503
     :body   "Application shut down"}))

(def routes {"api/" {"health-check" :health}})
(def match->handler {:health health-check})
