             [tobias.util :refer [timed load-config]])
   (:gen-class))
 
-(def ads->features (atom {}))
-
 (def features
   "A map that holds features and their possible values"
   {:ethnicity [:asian :black :hispanic :white]

         (assoc {} :winner)
         (merge {:features resulting-features}))))

(defn run-auction [image env-features]
  (->> image
       (get-features)
       (first) ; select only one feature (possibly the one with highest confidence), should be more clever
       (merge env-features)
       (get-winning-ad ads->features-example)))

(def ads (load-config (clojure.java.io/resource "ads.edn")))

(defn run-simulation [image env-features] (rand-nth ads))

(defroutes app-routes
  (GET "/" [] (content-type (resource-response "index.html" {:root "public"}) "text/html"))
  (POST "/auction/new"
        {{{image :tempfile} :file} :params} (response (run-auction image {:location :prime :weather :sunny})))
  (POST "/simulation/new"
        {{{image :tempfile} :file} :params} (response (run-simulation image {:location :prime :weather :sunny})))
  (route/resources "/")
  (route/not-found "Not Found"))


   :gender    [:male :female]
   :age       [:young :mid :old]
   :weather   [:sunny :rainy]})

(defn score-feature-set [feature-set result-set]
  "Returns an ad's feature set scored"
