 (s/def ::variation ::value-descriptor)
 (s/def ::direction ::value-descriptor)
 (s/def ::intervals (s/every ::audio/semitone))
-(s/def ::random-direction? boolean?)
+(s/def ::direction? #{-1 1})
 
 (om/defui ^:once ProgressBar
   Object

  (query [_] ['*])

  static om/Ident
  (ident [_ props] (om/ident (::parent props) props))

  Object
  (render [this]

  Object
  (render [this]
    (exercise (om/props this)
      (dom/p #js {:key "p"} "You will hear two notes - what is their interval?"))))

(defmulti slug->exercise identity)

(defmethod slug->exercise :default [_] nil)

(defmethod slug->exercise "pitch-1" [name]
  {::name  name
   ::class PitchDetection
   ::props {::variation [12 ".." 24]}})

(defmethod slug->exercise "pitch-2" [name]
  {::name  name
   ::class PitchDetection
   ::props {::variation [8 ".." 16]}})

(defmethod slug->exercise "pitch-3" [name]
  {::name  name
   ::class PitchDetection
   ::props {::variation [1 ".." 9]}})

(defmethod slug->exercise "identifying-octaves" [name]
  {::name  name
   ::class IdentifyOctaves
   ::props {}})

(defmethod slug->exercise "treble-clef-reading" [name]
  {::name  name
   ::class ReadingMusic
   ::props {}})

(defmethod slug->exercise "intervals-1" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-2" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-3" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-4" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-5" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-6" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2 11]
            ::pitch     ["C3" "C4" "C5"]
            ::direction 1}})

(defmethod slug->exercise "intervals-7" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7]
            ::direction 1}})

(defmethod slug->exercise "intervals-8" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4]
            ::direction 1}})

(defmethod slug->exercise "intervals-9" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5]
            ::direction 1}})

(defmethod slug->exercise "intervals-10" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9]
            ::direction 1}})

(defmethod slug->exercise "intervals-11" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2]
            ::direction 1}})

(defmethod slug->exercise "intervals-12" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2 11]
            ::direction 1}})

(defmethod slug->exercise "intervals-13" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-14" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-15" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-16" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-17" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-18" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2 11]
            ::pitch     ["C3" "C4" "C5"]
            ::direction -1}})

(defmethod slug->exercise "intervals-19" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7]
            ::direction -1}})

(defmethod slug->exercise "intervals-20" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4]
            ::direction -1}})

(defmethod slug->exercise "intervals-21" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5]
            ::direction -1}})

(defmethod slug->exercise "intervals-22" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9]
            ::direction -1}})

(defmethod slug->exercise "intervals-23" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2]
            ::direction -1}})

(defmethod slug->exercise "intervals-24" [name]
  {::name  name
   ::class Intervals
   ::props {::intervals [12 7 4 5 9 2 11]
            ::direction -1}})
