const express = require('express');
const router = express.Router();
const vendorQuotationRequestController = require('../controllers/vendorQuotationRequestController');
const { authenticate } = require('../middlewares/auth');

// All routes require authentication
router.use(authenticate);

// Create VQRs from RFQ (split by vendors)
router.post('/create-from-rfq', vendorQuotationRequestController.createFromRFQ);

// Get all VQRs
router.get('/', vendorQuotationRequestController.getAll);

// Generate PDF for VQR (must come before /:id to avoid route conflicts)
router.get('/:id/pdf', vendorQuotationRequestController.generatePDF);

// Mark VQR as sent
router.post('/:id/mark-as-sent', vendorQuotationRequestController.markAsSent);

// Get VQR by ID (must come after specific routes)
router.get('/:id', vendorQuotationRequestController.getById);

module.exports = router;

