/**
 * ASL模块路由注册
 */

import { FastifyInstance } from 'fastify';
import * as projectController from '../controllers/projectController.js';
import * as literatureController from '../controllers/literatureController.js';

export async function aslRoutes(fastify: FastifyInstance) {
  // ==================== 筛选项目路由 ====================
  
  // 创建筛选项目
  fastify.post('/projects', projectController.createProject);
  
  // 获取用户的所有项目
  fastify.get('/projects', projectController.getProjects);
  
  // 获取单个项目详情
  fastify.get('/projects/:projectId', projectController.getProjectById);
  
  // 更新项目
  fastify.put('/projects/:projectId', projectController.updateProject);
  
  // 删除项目
  fastify.delete('/projects/:projectId', projectController.deleteProject);

  // ==================== 文献管理路由 ====================
  
  // 导入文献（JSON）
  fastify.post('/literatures/import', literatureController.importLiteratures);
  
  // 导入文献（Excel上传）
  fastify.post('/literatures/import-excel', literatureController.importLiteraturesFromExcel);
  
  // 获取项目的文献列表
  fastify.get('/projects/:projectId/literatures', literatureController.getLiteratures);
  
  // 删除文献
  fastify.delete('/literatures/:literatureId', literatureController.deleteLiterature);

  // ==================== 筛选任务路由（后续实现） ====================
  
  // TODO: 启动筛选任务
  // fastify.post('/projects/:projectId/screening/start', screeningController.startScreening);
  
  // TODO: 获取筛选进度
  // fastify.get('/tasks/:taskId/progress', screeningController.getProgress);
  
  // TODO: 获取筛选结果
  // fastify.get('/projects/:projectId/results', screeningController.getResults);
  
  // TODO: 审核冲突文献
  // fastify.post('/results/review', screeningController.reviewConflicts);
}



