   {:user-id user-id
    :links (if (= access-level :author) [(remove-viewer-link org-slug slug user-id)] [])})
 
+(defn- comments
+  "Return a sequence of just the comments for an entry."
+  [{interactions :interactions}]
+  (filter :body interactions))
+
+(defn- reactions
+  "Return a sequence of just the reactions for an entry."
+  [{interactions :interactions}]
+  (filter :reaction interactions))
+
+(defn render-entry-for-collection
+  "Create a map of the activity for use in a collection in the API"
+  [org board entry access-level user-id]
+  (entry-rep/render-entry-for-collection org board entry (comments entry) (reactions entry) access-level user-id))
+
 (defn render-board-for-collection
   "Create a map of the board for use in a collection in the REST API"
   ([org-slug board] (render-board-for-collection org-slug board 0))


(defn render-board
  "Create a JSON representation of the board for the REST API"
  [org-slug board access-level params]
  (let [rep-props (if (or (= :author access-level) (= :viemer access-level))
                      representation-props
                      public-representation-props)]
    (json/generate-string
      (-> board
        (board-links org-slug access-level params)
        (select-keys rep-props))
      {:pretty config/pretty?})))
            [oc.storage.config :as config]
            [oc.storage.representations.media-types :as mt]
            [oc.storage.representations.org :as org-rep]
            [oc.storage.resources.board :as board-res]
            [oc.storage.urls.board :as board-url]
            [oc.storage.representations.entry :as entry-rep]))

(def public-representation-props [:uuid :slug :name :access :promoted :entries :created-at :updated-at :links])
(def representation-props (concat public-representation-props [:slack-mirror :author :authors :viewers :draft]))

(defn- self-link 
  ([org-slug slug] (hateoas/self-link (board-url/url org-slug slug) {:accept mt/board-media-type}))

  ([org-slug slug options] (hateoas/self-link (board-url/url org-slug slug) {:accept mt/board-media-type} options)))


(defn- create-entry-link [org-slug slug] (hateoas/create-link (str (board-url/url org-slug slug) "/entries/")
                                                {:content-type mt/entry-media-type
                                                 :accept mt/entry-media-type}))

(defn- partial-update-link [org-slug slug] (hateoas/partial-update-link (board-url/url org-slug slug)
                                              {:content-type mt/board-media-type
                                               :accept mt/board-media-type}))

(defn- delete-link [org-slug slug]
  (hateoas/delete-link (board-url/url org-slug slug)))

(defn- add-author-link [org-slug slug] 
  (hateoas/add-link hateoas/POST (str (board-url/url org-slug slug ) "/authors/") {:content-type mt/board-author-media-type}))

(defn- add-viewer-link [org-slug slug] 
  (hateoas/add-link hateoas/POST (str (board-url/url org-slug slug ) "/viewers/") {:content-type mt/board-viewer-media-type}))

(defn- remove-author-link [org-slug slug user-id]
  (hateoas/remove-link (str (board-url/url org-slug slug) "/authors/" user-id)))

(defn- remove-viewer-link [org-slug slug user-id]
  (hateoas/remove-link (str (board-url/url org-slug slug) "/viewers/" user-id)))

(defn- up-link [org-slug] (hateoas/up-link (org-rep/url org-slug) {:accept mt/org-media-type}))

