resource :notification_configs, only: [:show, :update]

resources :medical_logs, only: :index

namespace :accounting do
  resources :legacy_balances, only: :index
  resources :balances, only: :index
  resources :transactions, only: [:index, :show]

  resources :invoices, only: [:index, :show] do
    get :pdf, on: :member
  end

  resources :students, only: [] do
    scope module: :students do
      resource :matrices, only: :show
    end
  end
end

namespace :admissions do
  resource :config, only: :show
  resource :payment, only: :update

  resources :applications, only: :show

  resources :applicants, except: [:new, :edit, :destroy] do
    post :submit, on: :member

    scope module: :applicants do
      resource :family_revisions, only: :update
      resource :family_medical_revision, only: :update
      resource :payment, only: :update
      resource :medical, only: :update

      resources :additional_values, only: [], concerns: :batch_update
      resources :agreements, param: :agreement_id, only: [:index, :show, :update]
      resources :checkboxes, only: :index
      resources :classrooms, only: [], concerns: :batch_update
      resources :documents, param: :document_id, only: [:index, :show, :update]
      resources :enrollment_classrooms, only: :index
      resources :essays, param: :essay_id, only: [:index, :show, :update]
      resources :family_additional_values, only: [], concerns: :batch_update
      resources :family_contacts, only: [:show, :new, :create, :update, :destroy]

      namespace :tep do
        resource :fee, only: :create
      end
    end
  end

  namespace :paya do
    resources :forms, only: [] do
      get :payform, on: :collection
    end
  end

  namespace :payjunction do
    resources :transactions, only: :create
  end

  namespace :stripe do
    resources :sessions, only: [:show, :create]
  end
end

namespace :covid do
  resources :screenings, only: [:new, :create]
  resources :students, only: :index
end

namespace :discipline do
  resources :detentions, only: :index
  resources :logs, only: :index
end

scope module: :legacy do
  resource :directory, only: [:show, :update]

  resources :medical, only: [:index, :update]
  resources :missing_grades, only: :index
  resources :homework, only: [:index, :show]
  resources :contacts, only: [:index, :show, :update]
  resource  :contact_families, only: [:index, :show, :update]
  resources :ala_carte, only: [:index, :create]
  resources :parent_teacher_meetings, only: [:index, :create]
  resources :parent_teacher_configs, only: :index
  resources :parent_teacher_dates, only: :index
  resources :parent_teacher_users, only: :index

  resources :lunches, only: [:index, :create] do
    get :count, on: :collection
    get :week_count, on: :collection
  end

  resources :lunch_cycles, only: [] do
    get :open_dates, on: :collection
  end

  namespace :calendar do
    resources :events, only: [:index, :show]
  end

  resources :contacts, only: [] do
    scope module: :contacts do
      resources :email_addresses, only: [:create, :update, :destroy]
    end
  end

  namespace :service do
    resources :family_logs, only: [:index, :create, :update, :destroy] do
      get :statistics, on: :collection
    end

    resources :student_logs, only: [:index, :create, :update, :destroy] do
      get :statistics, on: :collection
    end
  end

  resources :students, only: [:index, :show] do
    scope module: :students do
      resource :details, only: :show
      resource :digital_equities, only: [:show, :update]
      resource :origins, only: [:show, :update]
      resource :races, only: [:show, :update]

      resources :assignments, only: :index
      resources :documents, only: :index
      resources :grade_postings, only: :index
      resources :names, only: :index

      resources :attendances, only: :index do
        get :statistics, on: :collection
      end

      resource :download_schedule, only: :show, controller: :download_schedule

      resources :classrooms, only: [:index, :show] do
        scope module: :classrooms do
          resources :assignments, only: :index
          resources :grade_postings, only: :index
        end
      end
    end
  end
end

namespace :financial_aid do
  resource :applications, only: [:show, :update] do
    post :credit_report
  end

  resource :config, only: :show

  resources :answers, only: :index, concerns: :batch_update
  resources :documents, only: [:index, :create, :destroy]

  namespace :stripe do
    resource :sessions, only: [:show, :create]
  end
end
