"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const auth_middleware_1 = require("../middleware/auth.middleware");
const rbac_middleware_1 = require("../middleware/rbac.middleware");
const admin_user_controller_1 = require("../controllers/admin-user.controller");
const coupon_controller_1 = require("../controllers/coupon.controller");
const banner_controller_1 = require("../controllers/banner.controller");
const newsletter_controller_1 = require("../controllers/newsletter.controller");
const contact_controller_1 = require("../controllers/contact.controller");
const router = (0, express_1.Router)();
// 1. Customer Management Routes
router.get('/admin/customers', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), admin_user_controller_1.getAllCustomers);
router.get('/admin/customers/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), admin_user_controller_1.getCustomerDetails);
router.put('/admin/customers/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), admin_user_controller_1.updateCustomer);
router.delete('/admin/customers/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), admin_user_controller_1.deleteCustomer);
router.post('/admin/customers/:id/toggle', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), admin_user_controller_1.toggleCustomerStatus);
// 2. Coupon Management Routes
router.get('/coupons', coupon_controller_1.getCoupons);
router.post('/coupons/apply', coupon_controller_1.applyCouponCode);
router.get('/admin/coupons', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), coupon_controller_1.getCoupons);
router.post('/admin/coupons', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), coupon_controller_1.createCoupon);
router.put('/admin/coupons/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), coupon_controller_1.updateCoupon);
router.delete('/admin/coupons/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), coupon_controller_1.deleteCoupon);
// 3. Banner Management Routes
router.get('/banners', banner_controller_1.getBanners);
router.get('/admin/banners', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), banner_controller_1.getAdminBanners);
router.post('/admin/banners', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), banner_controller_1.createBanner);
router.put('/admin/banners/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), banner_controller_1.updateBanner);
router.delete('/admin/banners/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), banner_controller_1.deleteBanner);
// 4. Newsletter Routes
router.post('/newsletter/subscribe', newsletter_controller_1.subscribeNewsletter);
router.get('/admin/newsletter/subscribers', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), newsletter_controller_1.getSubscribers);
router.post('/admin/newsletter/subscribers/:id/toggle', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), newsletter_controller_1.toggleSubscription);
router.delete('/admin/newsletter/subscribers/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), newsletter_controller_1.deleteSubscriber);
router.post('/admin/newsletter/campaign', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), newsletter_controller_1.sendNewsletterCampaign);
// 5. Contact Enquiry ticketing routes
router.post('/contact/submit', contact_controller_1.submitEnquiry);
router.get('/admin/tickets', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), contact_controller_1.getTicketsQueue);
router.put('/admin/tickets/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), contact_controller_1.replyToTicket);
router.delete('/admin/tickets/:id', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), contact_controller_1.deleteTicket);
exports.default = router;
//# sourceMappingURL=admin-mgmt.routes.js.map