import express from 'express';
import { wrapAsync } from '@/api/http/request';
import * as documents from '@/api/controllers/documents.controller';
import permissions from '@/middlewares/check-permissions';

const router = express.Router();

router.use(permissions.checkCrudPermissions('documents'));

router.post('/', wrapAsync(documents.create));
router.post('/bulk-import', wrapAsync(documents.bulkImport));
router.put('/:id', wrapAsync(documents.update));
router.delete('/:id', wrapAsync(documents.remove));
router.post('/deleteByIds', wrapAsync(documents.deleteByIds));
router.get('/', wrapAsync(documents.list));
router.get('/count', wrapAsync(documents.count));
router.get('/autocomplete', wrapAsync(documents.autocomplete));
router.get('/:id', wrapAsync(documents.findById));

export default router;
