 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Compojure App
 
-(schema/defn ^:always-validate status->code
+(schema/defn ^:always-validate status->code :- schema/Int
   "Given a service status, returns an appropriate HTTP status code"
-  [status :- ServiceStatus] :- schema/Int
+  [status :- ServiceStatus]
   (if (nominal? status) 200 503))
 
-(schema/defn ^:always-validate statuses->code
+(schema/defn ^:always-validate statuses->code :- schema/Int
   "Given a map of service statuses, returns an appropriate HTTP status code."
   [statuses :- ServicesStatus]
   (if (all-nominal? statuses) 200 503))

  string describing the error."
  [status-fn :- StatusFn
   level :- ServiceStatusDetailLevel
   timeout :- schema/Int] :- StatusCallbackResponse
   (let [unknown-response (fn [status] {:state :unknown
                                        :status status})
         timeout-response (unknown-response (format "Status check timed out after %s seconds" timeout))]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Public

(schema/defn ^:always-validate nominal? :- schema/Bool
  [status :- ServiceStatus]
  (= (:state status) :running))

(schema/defn ^:always-validate all-nominal? :- schema/Bool
  [statuses :- ServicesStatus]
  (every? nominal? (vals statuses)))

