               :jquery
               :clostache-templater
               :cylon
+              :cylon/signup             ; enable on with +signup switch
+              :cylon/log-emailer        ; enable on with +signup switch
+              :cylon/file-storage       ; TODO should be configurable
               :aggregate-template-model
               :protected-site-website
               }
    :files [{:template "protected-site/README.md" :target "README.md"}
            ]}
+
+  ;; TODO: It would be better for modules to have dependencies. Therefore, :cylon/signup would depend on :cylon/log-emailer. +sendgrid would augment with :sendgrid-emailer and diminish :cylon/log-emailer
 
   "intro"
   {:description "An introduction to Clojure (training course content)"

                {:component :modular.bidi/web-resources
                 :args [:uri-context "\"/static\""
                        :resource-prefix "\"public/\""]}}
   :dependencies {[:modular-bidi-router :webrouter] {:website :website
                                                     :static :static
                                                     :cylon-login [:cylon :login]}
                  :website {:templater [:clostache-templater :templater]
                            :session-store [:cylon :session-store]}
                  [:aggregate-template-model :template-model] [:website]
                  [:cylon :login] {:renderer :website}}
   :co-dependencies {:website {:router [:modular-bidi-router :webrouter]
                               :template-model [:aggregate-template-model :template-model]}
                     [:cylon :login] {:router [:modular-bidi-router :webrouter]}}
   :files [{:template "protected-site/website.clj" :target "src/{{sanitized}}/website.clj"}
           {:template "protected-site/html/page.html.mustache" :target "resources/templates/page.html.mustache"}
           {:template "protected-site/html/index.html.mustache" :target "resources/templates/index.html.mustache"}
           {:template "protected-site/html/login.html.mustache" :target "resources/templates/login.html.mustache"}
           {:template "protected-site/html/protected.html.mustache" :target "resources/templates/protected.html.mustache"}
           {:file "protected-site/style.css" :target "resources/public/style.css"}
           ]}

     :components #{:webmeta}
     :dependency-map {:template-model [:webmeta]}}

  {:module :cylon
   :components {
                :user-store
                {:component :cylon/email-user-store}

                :buddy-user-authenticator
                {:component :cylon/buddy-user-authenticator}

                :session-store
                {:component :cylon/cookie-session-store}

                :login-session-token-store
                {:component :cylon/atom-backed-token-store}

                :login
                {:component :cylon/login}
                }
   :dependencies {:session-store {:token-store :login-session-token-store}
                  :login {:user-store :user-store
                          :user-authenticator :buddy-user-authenticator
                          :session-store :session-store}
                  }

   :dev-snippets [{:template "dev/cylon/user.clj"}]}

  {:module :cylon/file-storage
   :components {:file-storage
                {:component :cylon/file-storage
                 :args [:file "(io/file (System/getProperty \"user.home\") \".{{name}}-userstore.edn\")"]}}
   :dependencies {[:cylon :user-store] {:storage :file-storage}}}

  {:module :cylon/signup
   :components {:signup
                {:component :cylon/signup}
                :verification-code-store
                {:component :cylon/atom-backed-token-store}
                }
   :dependencies {:signup {:user-store [:cylon :user-store]
                           :user-password-hasher [:cylon :buddy-user-authenticator]
                           :session-store [:cylon :session-store]
                           :verification-code-store :verification-code-store}}}

  ;; A log emailer which can be diminished in favour of a real emailer (e.g. sendgrid)
  {:module :cylon/log-emailer
   :components {:emailer
                {:component :modular.email/log-emailer}}
   :library-dependencies [;; temp while cylon in checkouts, because cylon already depends on juxt.modular/email
                          [juxt.modular/email "0.0.1"]]
   :dependencies {[:cylon/signup :signup] {:emailer :emailer}}}

  {:module :protected-site-website
   :components {:website
