import { Router } from 'express';
import { loadIntegrations } from '../../integrations.js';
import { requireAuth } from '../../middleware/auth.js';
import { registerTeamViewerRoutes } from '../../teamviewer.js';
import { registerAttachmentRoutes } from './attachments.js';
import { registerEventRoutes } from './events.js';
import { registerMachineRoutes } from './machines.js';
import { registerTicketRoutes } from './tickets.js';

export function createApiRouter() {
  const api = Router();
  api.use(requireAuth);
  registerMachineRoutes(api);
  registerTicketRoutes(api);
  registerAttachmentRoutes(api);
  registerTeamViewerRoutes(api, loadIntegrations);
  registerEventRoutes(api);
  return api;
}
