 (ns mount.core
   (:require [clojure.tools.macro :as macro]
-            [clojure.tools.logging :refer [info warn debug error]]))
+            [clojure.tools.logging :refer [info]]))
 
 ;; (defonce ^:private session-id (System/currentTimeMillis))
 (defonce ^:private mount-state 42)


(defn start [& states]
  (let [states (or (seq states) (all-without-subs))]
    (bring states up <)
    :started))

(defn stop [& states]
  (let [states (or states (find-all-states))]
    (doall (map unsub states))     ;; unmark substitutions marked by "start-with"
    (bring states down >)
    (doall (map rollback! states)) ;; restore to origin from "start-with"
    :stopped))

(defn stop-except [& states]
  (let [all (set (find-all-states))
        states (remove (set states) all)]
    (doall (map unsub states))     ;; unmark substitutions marked by "start-with"
    (bring states down >)
    (doall (map rollback! states)) ;; restore to origin from "start-with"
    :stopped))

(defn start-with-args [xs & states]
  (reset! -args xs)


(defn suspend [& states]
  (let [states (or (seq states) (all-without-subs))]
    {:suspended (bring states sigstop <)}))

(defn resume [& states]
  (let [states (or (seq states) (all-without-subs))]
    {:resumed (bring states sigcont <)}))
