"use strict";
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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const ImportContactsService = () => __awaiter(void 0, void 0, void 0, function* () {
    // const defaultWhatsapp = await GetDefaultWhatsApp();
    // const wbot = getWbot(defaultWhatsapp.id);
    // let phoneContacts;
    // try {
    //   phoneContacts = await wbot.getContacts();
    // } catch (err) {
    //   logger.error(`Could not get whatsapp contacts from phone. Err: ${err}`);
    // }
    // if (phoneContacts) {
    //   await Promise.all(
    //     phoneContacts.map(async ({ number, name }) => {
    //       if (!number) {
    //         return null;
    //       }
    //       if (!name) {
    //         name = number;
    //       }
    //       const numberExists = await Contact.findOne({
    //         where: { number }
    //       });
    //       if (numberExists) return null;
    //       let contact = await Contact.create({ number, name });
    //       // await contact.reload()
    //       // TEST DEL
    //       await createOrUpdateContactCache(`contact:${contact.id}`, {id:contact.id, name, number, profilePicUrl: contact.profilePicUrl, isGroup: contact.isGroup, extraInfo: '', email:'' })
    //       //
    //       // return Contact.create({ number, name });
    //       return contact
    //     })
    //   );
    // }
});
exports.default = ImportContactsService;
