"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getChatInfo = void 0;
const tslib_1 = require("tslib");
const helpers_1 = require("../helpers");
const constants_1 = require("../constants");
const axiosUtil_1 = require("../utils/axiosUtil");
const validationError_1 = require("../errors/validationError");
/**
 * Fetches the chat status for a given chat ID and address.
 */
const getChatInfo = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
    const { recipient, account, env = constants_1.default.ENV.PROD } = options;
    try {
        if (!recipient || !account) {
            throw new Error('receipient and account cannot be null or empty');
        }
        const API_BASE_URL = (0, helpers_1.getAPIBaseUrls)(env);
        const requestUrl = `${API_BASE_URL}/v1/chat/${yield (0, helpers_1.convertToValidDID)(recipient, env)}/address/${yield (0, helpers_1.convertToValidDID)(account, env)}`;
        const response = yield (0, axiosUtil_1.axiosGet)(requestUrl);
        return response.data;
    }
    catch (err) {
        throw (0, validationError_1.handleError)(err, exports.getChatInfo.name);
    }
});
exports.getChatInfo = getChatInfo;
//# sourceMappingURL=getChatInfo.js.map