                :message (str "Invalid service_status_version. Should be an "
                           "integer but was " level)}))))
 
-(schema/defn ^:always-validate summarize-states
+(schema/defn ^:always-validate summarize-states :- State
   "Given a map of service statuses:
    * if all of the statuses have the same :state, returns that :state
    * if not all of the statuses are the same, returns :unknown"
-  [statuses :- ServicesStatus] :- State
+  [statuses :- ServicesStatus]
   (let [state-set (->> statuses
                        vals
                        (map :state)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Compojure App

(schema/defn ^:always-validate status->code
  "Given a service status, returns an appropriate HTTP status code"
  [status :- ServiceStatus] :- schema/Int
  (if (nominal? status) 200 503))

(schema/defn ^:always-validate statuses->code
  "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]
   (let [unknown-response (fn [status] {:state :unknown
                                        :status status})
         timeout-response (unknown-response (format "Status check timed out after %s seconds" timeout))]
