import { Router } from 'express';
import multer from 'multer';
import { requireAuth } from '../middleware/auth';
import { uploadDocument, registerLocalDocument, extractAttachmentText, ocrImage } from '../controllers/document.controller';

const router = Router();
const upload = multer({ storage: multer.memoryStorage() });

router.post('/upload', upload.single('file'), requireAuth, uploadDocument);
router.post('/register-local', requireAuth, registerLocalDocument);
router.post('/extract-text', upload.single('file'), requireAuth, extractAttachmentText);
router.post('/ocr-image', requireAuth, ocrImage);

export default router;
