 
 (defn update-page
   [{:keys [id name width height layout] :as data}]
-  (sc/validate! +create-page-schema+ data)
+  (sc/validate! +update-page-schema+ data)
   (reify
     rs/UpdateEvent
     (-apply-update [_ state]

(defn create-project
  [{:keys [name width height layout] :as data}]
  (sc/validate! +project-schema+ data)
  (let [uuid (random-uuid)]
    (reify
      rs/UpdateEvent
      (-apply-update [_ state]
        (let [proj {:id uuid
                    :name name
                    :created (dt/now)}]
          (stpr/assoc-project state proj)))

      rs/EffectEvent
      (-apply-effect [_ state]
        (rs/emit! (create-page {:name "Page 1"
                                :layout layout
                                :width width
                                :height height
                                :project uuid}))))))
(defn delete-project
  [proj]
  (reify
    rs/UpdateEvent
    (-apply-update [_ state]
      (stpr/dissoc-project state proj))))

(defn go-to
  "A shortcut event that redirects the user to the

   :layout [sc/required sc/string]
   :width [sc/required sc/integer]
   :height [sc/required sc/integer]
   :data [sc/required]
   :project [sc/required sc/uuid]})

(def ^:static +update-page-schema+
  {:name [sc/required sc/string]
   :width [sc/required sc/integer]
   :height [sc/required sc/integer]
   :data [sc/required]
   :layout [sc/required sc/string]})

(def ^:static +update-page-metadata-schema+
  {:name [sc/required sc/string]
   :width [sc/required sc/integer]
   :height [sc/required sc/integer]
