"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const book_controller_1 = require("../controllers/book.controller");
const auth_middleware_1 = require("../middleware/auth.middleware");
const rbac_middleware_1 = require("../middleware/rbac.middleware");
const validate_middleware_1 = require("../middleware/validate.middleware");
const cache_middleware_1 = require("../middleware/cache.middleware");
const book_validator_1 = require("../validators/book.validator");
const router = (0, express_1.Router)();
// Public Catalog Endpoints with 5-minute Redis Caching
router.get('/', (0, cache_middleware_1.cacheMiddleware)(300), book_controller_1.getBooks);
router.get('/:slug', (0, cache_middleware_1.cacheMiddleware)(300), book_controller_1.getBookBySlug);
// Admin Single Book Management Endpoints
router.post('/', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(book_validator_1.createBookSchema), book_controller_1.createBook);
router.put('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(book_validator_1.updateBookSchema), book_controller_1.updateBook);
router.delete('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), book_controller_1.deleteBook);
// Admin Bulk Operations Endpoints
router.post('/bulk-delete', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(book_validator_1.bulkDeleteBooksSchema), book_controller_1.bulkDeleteBooks);
router.post('/bulk-update', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(book_validator_1.bulkUpdateBooksSchema), book_controller_1.bulkUpdateBooks);
router.post('/bulk-import', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(book_validator_1.bulkImportBooksSchema), book_controller_1.bulkImportBooks);
router.get('/export/catalog', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), book_controller_1.exportBooks);
exports.default = router;
//# sourceMappingURL=book.routes.js.map