const fsPromises = require("fs/promises");
const fs = require('fs')

import WhatsQueueIndex from "./WhatsQueueIndex";

// Delete a directory and its children 
export const WhatsIndex = (whatsapps: Object[]) => {

    let index: number = 0

    if (WhatsQueueIndex.getIndex() >= whatsapps.length) {
        WhatsQueueIndex.setIndex(0)
    } 

    index = +WhatsQueueIndex.getIndex()

    WhatsQueueIndex.setIndex(+WhatsQueueIndex.getIndex() + 1)

    console.log('WhatsQueue Index: ', index)

    return index

}