"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSessionDir = void 0;
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
// Delete a directory and its children 
const createSessionDir = () => {
    console.log('process.cwd(): ', process.cwd());
    const wwebjsAuthPath = path_1.default.join(process.cwd(), '.wwebjs_auth');
    const sessionPath = path_1.default.join(process.cwd(), '.wwebjs_auth', 'sessions');
    const sessionLogPath = path_1.default.join(process.cwd(), '.wwebjs_auth', 'sessions', 'log');
    fs_1.default.access(wwebjsAuthPath, (error) => {
        // To check if the given directory 
        // already exists or not
        if (error) {
            // If current directory does not exist
            // then create it
            fs_1.default.mkdir(wwebjsAuthPath, (error) => {
                if (error) {
                    console.log(error);
                }
                else {
                    console.log(`wwebjs_auth Directory created successfully !!!`);
                }
            });
        }
        else {
            console.log("wwebjs_auth Directory already exists !!");
        }
    });
    fs_1.default.access(sessionPath, (error) => {
        // To check if the given directory 
        // already exists or not
        if (error) {
            // If current directory does not exist
            // then create it
            fs_1.default.mkdir(sessionPath, (error) => {
                if (error) {
                    console.log(error);
                }
                else {
                    console.log(`sessions Directory created successfully !!!`);
                }
            });
        }
        else {
            console.log("sessions Directory already exists !!");
        }
    });
    fs_1.default.access(sessionLogPath, (error) => {
        // To check if the given directory 
        // already exists or not
        if (error) {
            // If current directory does not exist
            // then create it
            fs_1.default.mkdir(sessionLogPath, (error) => {
                if (error) {
                    console.log(error);
                }
                else {
                    console.log(`log Directory created successfully !!!`);
                }
            });
        }
        else {
            console.log("log Directory already exists !!");
        }
    });
};
exports.createSessionDir = createSessionDir;
