(ns auto-ap.routes.invoice)
(def routes {""                            {:get ::all-page
                                            "/unpaid" ::unpaid-page
                                            "/paid" ::paid-page
                                            "/voided" ::voided-page
                                            "/import" {"" ::import-page
                                                       "/upload" ::import-file
                                                       "/table" ::import-table
                                                       "/disapprove" {:delete ::bulk-disapprove}
                                                       "/approve" {:put ::bulk-approve}
                                                       ["/" [#"\d+" :db/id] "/disapprove"] ::disapprove
                                                       ["/" [#"\d+" :db/id] "/approve"] ::approve}}
             "/new" {:get ::new-wizard
                     :post ::new-invoice-submit
                     :put ::new-invoice-submit
                     "/due-date" ::due-date
                     "/scheduled-payment-date" ::scheduled-payment-date
                     "/navigate" ::new-wizard-navigate
                     "/account/new" ::new-wizard-new-account
                     "/account/location-select" ::location-select
                     "/account/prediction" ::account-prediction
                     "/total" ::expense-account-total
                     "/balance" ::expense-account-balance}
             
             "/pay-button" ::pay-button

             "/pay" {:get ::pay-wizard
                     "/using-credit" ::pay-using-credit
                     
                     "/navigate" ::pay-wizard-navigate
                     :post ::pay-submit}
             "/bulk-delete" {:get ::bulk-delete
                             :delete ::bulk-delete-confirm}
             "/bulk-edit" {:get ::bulk-edit
                           :put ::bulk-edit-submit
                           "/account" ::bulk-edit-new-account
                           "/total" ::bulk-edit-total
                     "/balance" ::bulk-edit-balance}
             ["/" [#"\d+" :db/id]] {:delete ::delete
                                    "/undo-autopay"  ::undo-autopay
                                    "/unvoid" ::unvoid
                                    "/edit" ::edit-wizard}
             "/table"                      ::table })

(def legacy-routes {""  ::legacy-invoices
                    "import" ::legacy-import-invoices
                    "unpaid" ::legacy-unpaid-invoices
                    "paid" ::legacy-paid-invoices
                    "voided" ::legacy-voided-invoices
                    "new" ::legacy-new-invoice})
