// Function returns JSON error object for the 400 Bad Request response code
// IN: error_msg : string with detailed error message (i.e., int conversion error)
// OUT: API error object
function return_error_400(error_msg) {
    return {
        message:
            'A parameter or property is missing a value or has an invalid format.',
        error: error_msg,
    };
}

// Function returns JSON error object for the 404 Not Found response code
// IN: error_msg : string with detailed error message (i.e., int conversion error)
// OUT: API error object
function return_error_404(error_msg) {
    return {
        message: 'A parameter or property contains an invalid value.',
        error: error_msg,
    };
}

// Function returns JSON error object for the 500 Internal Server Error response code
// IN: error_msg : string with detailed error message (i.e., from database try/catch)
// OUT: API error object
function return_error_500(error_msg) {
    return {
        message: 'An internal server error occurred.',
        error: error_msg,
    };
}

// Export functions for use in other modules
module.exports = {
    return_error_400: (error_msg) => return_error_400(error_msg),
    return_error_404: (error_msg) => return_error_404(error_msg),
    return_error_500: (error_msg) => return_error_500(error_msg),
};
