 (ns s7p.core
   (:require [clojure.data.json :as json]
             [org.httpkit.client :as http]
-            [core.async :refer [go]]))
+            [clojure.core.async :as a]))
 
 (def options {:timeout 100
               :keepalive 3000})

(defn pick-winner-and-second-price [floor-price resps]
  ;; TODO: second price
  (->> resps
       (argmaxes-and-second floor-price :bidPrice)
       ;; branch the size of maxes
       (rand-nth)))

   :user "user-1"
   :test 1})

(defn validate [{:keys [status body error]}]
  ;; FIXME: implement
  (and
   (= status 200)
   ;; TODO: treat 204 and the others

   (:id body)
   ;; and string

   (:bidPrice body)
   ;; and double

   (:advertiserId body)
   ;; and string

   )
  {:valid body}
  )

(defn succeed? [res]
  ;; FIXME: implement
  {:valid res}
  true
  )

