const express = require('express')

const v1Router = express.Router()

const authRouter = require('./auth')
const publicRouter = require('./public')
const adminRouter = require('./admin')
const playerRouter = require('./player')
const settingsRouter = require('./settings')

v1Router.use('/auth', authRouter)
v1Router.use('/public', publicRouter)
v1Router.use('/admin', adminRouter)
v1Router.use('/player', playerRouter)
// Site-wide settings that need a login but no particular role — currently the
// nav overrides the admin and player layouts read for themselves. Not /public
// (the admin nav's labels describe the admin surface), not /admin (editors and
// moderators render AdminLayout but are not admins), not /player (this is
// configuration, not self-scoped data). See settings/index.js.
v1Router.use('/settings', settingsRouter)
// NOTE: /internal is intentionally NOT mounted here. Those routes return the
// decrypted Discord bot token and must never share the public listener that
// Pangolin proxies. They live on a separate, unpublished port via
// server/src/internalApp.js (started in server.js). See issue #33.

module.exports = v1Router
