"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendError = exports.sendSuccess = void 0;
const sendSuccess = (res, message = 'Operation successful', data, statusCode = 200, meta) => {
    const responseBody = {
        success: true,
        message,
        data,
    };
    if (meta) {
        responseBody.meta = meta;
    }
    return res.status(statusCode).json(responseBody);
};
exports.sendSuccess = sendSuccess;
const sendError = (res, message = 'An unexpected error occurred', errorOrStatus = null, statusCode = 500) => {
    const resolvedStatusCode = typeof errorOrStatus === 'number' ? errorOrStatus : statusCode;
    const error = typeof errorOrStatus === 'number' ? null : errorOrStatus;
    const responseBody = {
        success: false,
        message,
    };
    if (error) {
        responseBody.error = error;
    }
    return res.status(resolvedStatusCode).json(responseBody);
};
exports.sendError = sendError;
//# sourceMappingURL=response.utils.js.map