const { sendResponse } = require('../helpers/responseHelper');
const {httpStatus, httpStatusMessages} = require('../helpers/httpResponses')
function apiKeyValidation(req, res, next) {
    const apiKey = req.headers['x-api-key'];

    if (apiKey !== req.app.locals.apiKey) {
        return sendResponse(res, httpStatus.UNAUTHORIZED, httpStatusMessages[httpStatus.UNAUTHORIZED]);
    }
    next();
}

module.exports = apiKeyValidation;