const router = require('express').Router();
const { isAuthenticated, allowRoles } = require('../middlewares/authenticate');
const {
    createVendorStaff,
    getAllVendorStaff,
    getVendorStaffById,
    updateVendorStaff,
    deleteVendorStaff
} = require('../controllers/vendor.staff.controller');
const { checkPermission } = require('../middlewares/checkPermission');

// These routes are nested under /api/v1/vendor/staff

// Create Staff
router.post(
    '/create',
    isAuthenticated,
    allowRoles('vendor'),
    // checkPermission('manage_staff'), // Optional: if vendor roles are granular
    createVendorStaff
);

// Get All Staff
router.get(
    '/all',
    isAuthenticated,
    allowRoles('vendor'),
    getAllVendorStaff
);

// Get Staff by ID
router.get(
    '/:id',
    isAuthenticated,
    allowRoles('vendor'),
    getVendorStaffById
);

// Update Staff
router.put(
    '/:id',
    isAuthenticated,
    allowRoles('vendor'),
    updateVendorStaff
);

// Delete Staff
router.delete(
    '/:id',
    isAuthenticated,
    allowRoles('vendor'),
    deleteVendorStaff
);

module.exports = router;
