function sendError(res, status, code, message, details = null) {
  const payload = {
    error: message,
    code,
  };

  if (details) {
    payload.details = details;
  }

  return res.status(status).json(payload);
}

module.exports = {
  sendError,
};
