"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const tracking_controller_1 = require("../controllers/tracking.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 tracking_validator_1 = require("../validators/tracking.validator");
const router = (0, express_1.Router)();
// ==========================================
// PUBLIC ENDPOINTS (No login required)
// ==========================================
router.get('/carriers', tracking_controller_1.getCarriers);
router.get('/search/:query', tracking_controller_1.trackPublicOrder);
router.post('/search', tracking_controller_1.trackPublicOrder);
router.get('/:query', tracking_controller_1.trackPublicOrder);
// ==========================================
// CARRIER WEBHOOKS (Public / Header verification)
// ==========================================
router.post('/webhook/:carrier', tracking_controller_1.handleCarrierWebhook);
// ==========================================
// ADMIN LOGISTICS DISPATCH & TIMELINE
// ==========================================
router.post('/shipment', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(tracking_validator_1.updateShipmentSchema), tracking_controller_1.updateShipment);
router.post('/event', auth_middleware_1.authenticateJWT, (0, rbac_middleware_1.authorizeRoles)('ADMIN'), (0, validate_middleware_1.validateRequest)(tracking_validator_1.addTrackingEventSchema), tracking_controller_1.addTrackingEvent);
exports.default = router;
//# sourceMappingURL=tracking.routes.js.map