 (ns tenor.entities)
 
-(defrecord Note [note-value pitch-letter octave])
+(defprotocol Entity
+  (repr [this])
+  (generated [this]))
+
+(defrecord Note [note-value pitch-letter octave]
+  Entity
+  (repr [this] (keyword (str pitch-letter octave)))
+)
 
 (defn make-note [notation]
   (let [notation-re #"^(1|2|4|8|16)([A-G])([#b]?)([1-9])$"

  (cond
    (> note-count 3)
    (let [beat (rand-nth [2 3 4])
          sig (concat (or sig '()) (range 1 (inc beat)))]
      (time-signature (- note-count beat) sig))
    (and (<= note-count 3) (> note-count 0))
    (let [sig (concat (or sig '()) (range 1 (inc note-count)))]
      (time-signature 0 sig))
    :else sig))


      (fn [x] (or (= 1 x) (rand-nth [true false])))
      notes)))

(defrecord Beat [note-count note-value]
  Entity
  (generated [this] (segment-beat note-count note-value)))

(defrecord Measure [note-count note-value]
  Entity
  (generated [this] (time-signature note-count)))
