import * as plugins from './plugins.js';
// Base directories
export const baseDir = process.cwd();
export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
export const distServe = plugins.path.join(packageDir, './dist_serve');
// Configure data directory with environment variable or default to .nogit/data
const DEFAULT_DATA_PATH = '.nogit/data';
export const dataDir = process.env.DATA_DIR
    ? process.env.DATA_DIR
    : plugins.path.join(baseDir, DEFAULT_DATA_PATH);
// MTA directories 
export const keysDir = plugins.path.join(dataDir, 'keys');
export const dnsRecordsDir = plugins.path.join(dataDir, 'dns');
export const sentEmailsDir = plugins.path.join(dataDir, 'emails', 'sent');
export const receivedEmailsDir = plugins.path.join(dataDir, 'emails', 'received');
export const failedEmailsDir = plugins.path.join(dataDir, 'emails', 'failed'); // For failed emails
export const logsDir = plugins.path.join(dataDir, 'logs'); // For logs
// Email template directories
export const emailTemplatesDir = plugins.path.join(dataDir, 'templates', 'email');
export const MtaAttachmentsDir = plugins.path.join(dataDir, 'attachments'); // For email attachments
// Configuration path
export const configPath = process.env.CONFIG_PATH
    ? process.env.CONFIG_PATH
    : plugins.path.join(baseDir, 'config.json');
// Create directories if they don't exist
export async function ensureDirectories() {
    // Ensure data directories
    await plugins.smartfs.directory(dataDir).recursive().create();
    await plugins.smartfs.directory(keysDir).recursive().create();
    await plugins.smartfs.directory(dnsRecordsDir).recursive().create();
    await plugins.smartfs.directory(sentEmailsDir).recursive().create();
    await plugins.smartfs.directory(receivedEmailsDir).recursive().create();
    await plugins.smartfs.directory(failedEmailsDir).recursive().create();
    await plugins.smartfs.directory(logsDir).recursive().create();
    // Ensure email template directories
    await plugins.smartfs.directory(emailTemplatesDir).recursive().create();
    await plugins.smartfs.directory(MtaAttachmentsDir).recursive().create();
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wYXRocy50cyJdLCJuYW1lcyI6W10sIm1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