import { Router } from 'express'

import workerAuthPublicRoutes from './worker/auth-public.js'
import workerAuthSessionRoutes from './worker/auth-session.js'
import workerProfileRoutes from './worker/profile.js'
import workerHallRoutes from './worker/hall.js'
import workerOrdersRoutes from './worker/orders.js'
import { requireWorkerSession } from './worker/session.js'
import { buildNotFoundPayload } from '../utils/http.js'

const router = Router()

router.use(workerAuthPublicRoutes)

router.use(requireWorkerSession)

router.use(workerAuthSessionRoutes)

router.use(workerProfileRoutes)

router.use(workerHallRoutes)

router.use(workerOrdersRoutes)

router.use((req, res) => {
  res.status(404).json(buildNotFoundPayload(req))
})

export default router
