const { body } = require('express-validator');
const { validation, driverAuth } = require('../../middlewares');
const { scan, list } = require('../../controllers/drivers/onboardings');

const router = require('express').Router();

router.post(
	'/',
	driverAuth,
	[
		body('type').isIn(['onboarding', 'offboarding']).withMessage('Type must be either "onboarding" or "offboarding"'),
		body('qr').notEmpty().withMessage('QR code is required'),
		validation,
	],
	scan,
);

router.get('/list', driverAuth, list);

module.exports = router;
