import { Express } from 'express';
import authRoutes from './auth.js';
import userRoutes from './users.js';
import accountRoutes from './accounts.js';
import publishRoutes from './publish.js';
import commentRoutes from './comments.js';
import analyticsRoutes from './analytics.js';
import uploadRoutes from './upload.js';
import systemRoutes from './system.js';
import aiRoutes from './ai.js';
import worksRoutes from './works.js';
import tasksRoutes from './tasks.js';
import internalRoutes from './internal.js';
import workDayStatisticsRoutes from './workDayStatistics.js';
import { authenticate } from '../middleware/auth.js';

export function setupRoutes(app: Express): void {
  app.use('/api/auth', authRoutes);
  app.use('/api/users', userRoutes);
  app.use('/api/accounts', accountRoutes);
  app.use('/api/account-groups', accountRoutes); // 账号分组也在 accounts 路由中
  app.use('/api/works', worksRoutes);
  app.use('/api/publish', publishRoutes);
  app.use('/api/comments', commentRoutes);
  app.use('/api/analytics', analyticsRoutes);
  app.use('/api/work-day-statistics', workDayStatisticsRoutes);
  app.use('/api/upload', uploadRoutes);
  app.use('/api/system', systemRoutes);
  app.use('/api/ai', aiRoutes);
  app.use('/api/tasks', authenticate, tasksRoutes);
  app.use('/api/internal', internalRoutes); // 内部 API（供 Python 服务调用）
}
