// Settings · Nav — the admin-sidebar and player-portal nav overrides, readable
// by the accounts those navs are rendered for.
//
// Mounted at /api/v1/settings/nav by settings/index.js, which already applied
// `noindex, requireAuth`. No role gate on purpose: an editor, a moderator and a
// player each need the override for the layout they see, and the payload is
// presentation-only — label/order/hidden/group over items the reader's own
// role/feature filter still gets the final say on
// (docs/website/THEMING_AND_NAV.md §7).

const express = require('express')

const ctrl = require('./nav.controller')

const navRouter = express.Router()

navRouter.get(
  '/',
  // #swagger.tags = ['Settings']
  // #swagger.summary = 'Nav overrides for the admin and player layouts'
  // #swagger.description = 'Returns the stored nav_admin and nav_player overrides as raw JSON strings (null when the admin never overrode that nav). Any authenticated account may read them: AdminLayout renders for editors and moderators, PlayerPortalLayout for players, and none of them can read GET /admin/settings. Presentation-only — the role/feature filters in the layouts still decide what is actually shown.'
  // #swagger.security = [{ "cookieAuth": [] }, { "bearerAuth": [] }]
  /* #swagger.responses[200] = { description: 'Nav overrides', content: { "application/json": { schema: { $ref: "#/components/schemas/NavSettings" } } } } */
  /* #swagger.responses[401] = { description: 'Not authenticated', content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } } */
  ctrl.getNav,
)

module.exports = navRouter
