(ns auto-ap.ssr.core
  (:require
   [auto-ap.routes.utils
    :refer [wrap-admin wrap-client-redirect-unauthenticated wrap-secure]]
   [auto-ap.ssr.admin :as admin]
   [auto-ap.ssr.auth :as auth]
   [auto-ap.ssr.company.company-1099 :as company-1099]
   [auto-ap.ssr.company-dropdown :as company-dropdown]))

;; from auto-ap.ssr-routes, because they're shared


(def key->handler {:logout                     auth/logout
                   :admin-history              (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
                   :admin-history-search       (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history-search)))
                   :admin-history-inspect      (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/inspect)))
                   :active-client              (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin company-dropdown/active-client)))
                   :company-dropdown-contents  (wrap-client-redirect-unauthenticated (wrap-secure company-dropdown/dropdown-contents)) 
                   :company-1099               (wrap-client-redirect-unauthenticated (wrap-secure company-1099/page))
                   :company-1099-vendor-table  (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-table))
                   :company-1099-vendor-dialog (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-dialog))
                   :company-1099-vendor-save   (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-save))})

