import { createCrudRoutes } from '@/server/utils/generic-crud.routes';
import { ConsultationRequest } from '@/server/modules/consultation/consultation-request.entity';
import { ConsultationRequestSchema, CreateConsultationRequestDto, UpdateConsultationRequestDto } from '@/server/modules/consultation/consultation-request.schema';
import { authMiddleware } from '@/server/middleware/auth.middleware';

// 使用通用CRUD路由创建管理后台API
const consultationRequestRoutes = createCrudRoutes({
  entity: ConsultationRequest,
  createSchema: CreateConsultationRequestDto,
  updateSchema: UpdateConsultationRequestDto,
  getSchema: ConsultationRequestSchema,
  listSchema: ConsultationRequestSchema,
  searchFields: ['customerName', 'companyName', 'projectType', 'projectDescription'],
  middleware: [authMiddleware]
});

export default consultationRequestRoutes;