"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const blog_controller_1 = require("../controllers/blog.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 blog_validator_1 = require("../validators/blog.validator");
const router = (0, express_1.Router)();
// Public Blog Endpoints
router.get('/', blog_controller_1.getBlogs);
router.get('/:slug', blog_controller_1.getBlogBySlug);
router.post('/comments', (0, validate_middleware_1.validateRequest)(blog_validator_1.createCommentSchema), blog_controller_1.addBlogComment);
// Admin CMS Endpoints
router.post('/', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(blog_validator_1.createBlogSchema), blog_controller_1.createBlog);
router.put('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(blog_validator_1.updateBlogSchema), blog_controller_1.updateBlog);
router.delete('/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), blog_controller_1.deleteBlog);
exports.default = router;
//# sourceMappingURL=blog.routes.js.map