"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const variant_controller_1 = require("../controllers/variant.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 variant_validator_1 = require("../validators/variant.validator");
const router = (0, express_1.Router)();
// Public routes
router.get('/book/:bookId', variant_controller_1.getVariantsByBookId);
router.get('/:id', variant_controller_1.getVariantById);
// Admin Variant Management
router.post('/book/:bookId', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(variant_validator_1.createVariantSchema), variant_controller_1.createVariant);
router.put('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(variant_validator_1.updateVariantSchema), variant_controller_1.updateVariant);
router.delete('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), variant_controller_1.deleteVariant);
router.patch('/:id/stock', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(variant_validator_1.updateVariantStockSchema), variant_controller_1.updateVariantStock);
exports.default = router;
//# sourceMappingURL=variant.routes.js.map