import { Router } from 'express'

import authRouter from './admin/auth.js'
import auditLogsRouter from './admin/audit-logs.js'
import cloudtentaclesRecordsRouter from './admin/cloudtentacles-records.js'
import dashboardRouter from './admin/dashboard.js'
import devMockRouter from './admin/dev-mock.js'
import financeRouter from './admin/finance.js'
import filesRouter from './admin/files.js'
import kuaishouIndustryRouter from './admin/kuaishou-industry.js'
import ordersRouter from './admin/orders.js'
import notificationsRouter from './admin/notifications.js'
import realtimeRouter from './admin/realtime.js'
import rbacRouter from './admin/rbac.js'
import platformConfigRouter from './admin/platform-config.js'
import { requireAdminSession } from './admin/session.js'
import tasksRouter from './admin/tasks.js'
import usersRouter from './admin/users.js'
import workerPlatformRouter from './admin/worker-platform.js'
import { buildNotFoundPayload } from '../utils/http.js'

const router = Router()

router.use(authRouter)
router.use(requireAdminSession)
router.use(filesRouter)
router.use(dashboardRouter)
router.use(financeRouter)
router.use(usersRouter)
router.use(rbacRouter)
router.use(auditLogsRouter)
router.use(platformConfigRouter)
router.use(kuaishouIndustryRouter)
router.use(ordersRouter)
router.use(notificationsRouter)
router.use(realtimeRouter)
router.use(tasksRouter)
router.use(cloudtentaclesRecordsRouter)
router.use(workerPlatformRouter)
router.use(devMockRouter)

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

export default router
