import { default as pathUtils } from 'path';
import { fileURLToPath } from 'node:url';
import { delay, getUUID, } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
/**
 * helper function to get the filename for use in specs.
 *
 * @param importMetaUrl import.meta.url
 * @returns currently executing filename sans .respec.mjs
 */
export async function getCurrentFilename(importMetaUrl) {
    const lc = `[${getCurrentFilename.name}]`;
    try {
        const filePath = fileURLToPath(importMetaUrl);
        const filenameWithExt = pathUtils.basename(filePath);
        const filename = filenameWithExt.replace(/\.respec\.mjs$/, '');
        return `ibgib${pathUtils.sep}${filename}`;
    }
    catch (error) {
        console.error(`${lc} ${error.message}`);
        throw error;
    }
}
export async function specGetSpaceId() {
    await delay(10);
    let uuid = await getUUID();
    let now = new Date();
    now.getMinutes();
    let timeComponent = now.getMinutes().toString() + now.getSeconds().toString() + now.getMilliseconds().toString();
    uuid = timeComponent + uuid.substring(timeComponent.length, uuid.length);
    return uuid;
}
export function specGetSpaceName(uuid) {
    return uuid.substring(0, 8) + '-space';
}
export function specGetSpaceDescription(uuid) {
    return 'description for ' + uuid.substring(0, 8);
}
export function specGetBaseDir(testBaseDirRoot, uuid, logalot, lc) {
    const dir = pathUtils.join(".", testBaseDirRoot, specGetSpaceName(uuid) + "_baseDir");
    if (logalot) {
        console.log(`${lc}[${specGetBaseDir.name}] dir: ${dir} (I: 410c57b7d02ac2ddf9ca32493ad19523)`);
    }
    return dir;
}
export function specGetBaseSubPath(testBaseDirRoot, uuid, logalot, lc) {
    return "tmp";
}
//# sourceMappingURL=spec-helper.node.respec.mjs.map