    [yada.yada :as yada :refer [yada resource as-resource]]
    [ring.middleware.cookies :refer [cookies-request cookies-response]])
   (:import [modular.bidi Router]))
-
-(defn hello []
-  (yada "Hello World!\n"))
-
-(defn- login-form-html [fields]
-  (html
-   [:div
-    [:style "* {margin:2px;padding:2px}"]
-    [:h1 "Login form"]
-    [:form {:method :post}
-     (for [{:keys [label type name]} fields]
-       [:div
-        [:label {:for name} label]
-        [:input {:type type :name name}]])
-     [:div [:input {:type :submit :name :submit :value "Login"}]]]]))
 
 (defn- login-form-parameters [fields]
   {:form

     :methods
     {:get
      {:produces "text/html"
       :response (login-form-html fields)}
      
      :post
      {:parameters (login-form-parameters fields)

         (resource
          {:id ::secret
           :access-control
           {:scheme "Custom"
            :verify identity
            :authorization {:methods {:get [:and
                                            "accounts/view"
                                            "accounts/view"]}}}
           :methods {:get {:response (fn [ctx]
                                       (html
                                        [:h1 "Seek happiness"]
                                        [:p [:a {:href (path-for @*router ::logout)} "logout"]]))
                           :produces "text/html"}}
           :responses {401 {:produces "text/html" ;; TODO: If we neglect to put in produces we get an error
                            :response (fn [ctx]
                                        (html
                                         [:h1 "Sorry"]
                                         [:p "You are not authorized yet"]
                                         [:p "Please " [:a {:href (path-for @*router ::login)} "login" ]]))}}}))}]]]

    (catch Throwable e
      (errorf e "Getting exception on security example routes")
