"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fsPromises = require("fs/promises");
const fs = require('fs');
const axios_1 = __importDefault(require("axios"));
const https = __importStar(require("https"));
const sendMessageAPI = (url, body) => __awaiter(void 0, void 0, void 0, function* () {
    let response = null;
    try {
        const httpsAgent = new https.Agent({ rejectUnauthorized: false, });
        response = yield axios_1.default.post(url, {
            'x-api-token': 'e23dcfdfeb6be5b91b1bf5c55ee50cc4405f2802',
            'x-api-app': 'x-api-app',
        }, {
            httpsAgent,
            headers: { 'Content-Type': 'multipart/form-data' },
        });
        console.log(`TEST URL CLIENT POST ROUTE: ${url} | STATUS CODE: ${response.status}`);
        // if (method == 'get') {
        //   // const url = 'https://sos.espacolaser.com.br/api/whatsapp/ticket/R32656'  
        //   response = await axios.get(url, {
        //     httpsAgent,
        //     headers: {
        //       'x-access-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOnsiaWQiOjEsInJvbGUiOiJjbGllbnQiLCJob3N0Ijoic29zLmVzcGFjb2xhc2VyLmNvbS5iciIsInRlbmFudCI6ImVzcGFjb2xhc2VyIiwibmFtZSI6IlNFTlNSLklUIiwiY29tcGFueSI6eyJpZCI6NDR9fSwiZGF0ZSI6MTY2MTI2MjY0MywiaWF0IjoxNjYxMjYyNjQzLCJleHAiOjE3NDc2NjI2NDN9.zf91OmRs4_C7B8OlVpLLrQMiRBYc7edP4qAdH_hqxpk',
        //       'Origin': 'espacolaser'
        //     }
        //   });
        //   console.log(`TEST URL CLIENT GET ROUTE: ${url} | STATUS CODE: ${response.status}`);
        // }
        // else if (method == 'post') {
        //   // const url = 'http://177.107.193.124:8095/labs/zabbix-frontend/api/api.php'  
        //   response = await axios.post(url, {
        //     'auth': '0424bd59b807674191e7d77572075f33',
        //     'jsonrpc': '2.0',
        //     'method': 'chamado.ematendimento',
        //     'params[ccusto]': param,
        //     id: '101'
        //   }, {
        //     httpsAgent,
        //     headers: { 'Content-Type': 'multipart/form-data' },
        //   });
        //   console.log(`TEST URL CLIENT POST ROUTE: ${url} | STATUS CODE: ${response.status}`);
        // }
    }
    catch (error) {
        console.error(`Erro ao consultar endpoint ${url}: ${error}`);
    }
    return response;
});
exports.default = sendMessageAPI;
