                    [schema.core :as sm])
   (:use [cljs.core.async :only [chan <! >! put! timeout]]))
 
-(sm/defschema MoveDirection (s/enum :up :right :down :left))
-(sm/defschema IntendedMoveDirection #{MoveDirection})
+(sm/defschema Direction (s/enum :up :right :down :left))
+(sm/defschema IntendedDirection #{Direction})
 
 (sm/defschema Entity {:id                         s/Int
                       (s/maybe :position)         {:x s/Num

    (let [msg (<! event-chan)]
      (js/console.log (clj->js msg))
      (case (msg :type)
        ; TODO function for getting the player
        :move-key-down (swap! state update-in [:entities 0 :human-controlled :intended-move-direction] conj (msg :direction))
        :move-key-up (swap! state update-in [:entities 0 :human-controlled :intended-move-direction] disj (msg :direction))
        )
      (js/console.log (clj->js (get-in @state [:entities 0 :human-controlled :intended-move-direction])))
      (recur))))

(defn ^:export main []

              (put! event-chan {:type      event-type
                                :direction (key-mappings code)}))))))))

(sm/defn update-player [state :- GameState & args]
  (apply update-in
         state
         (concat [:entities 0] (first args))
         (rest args)))

(defn handle-events [state event-chan]
  (listen-to-keyboard-inputs event-chan)

