import electron from 'electron';
const { app } = electron;
import { join } from 'node:path';
import { mkdirSync } from 'node:fs';

export interface ProfilePaths {
  profileDir: string;
  dbFile: string;
  mediaDir: string;
}

export function resolveProfilePaths(profile = 'default'): ProfilePaths {
  const root = join(app.getPath('userData'), 'Inkling', 'profiles', profile);
  const p: ProfilePaths = {
    profileDir: root,
    dbFile: join(root, 'inkling.sqlite'),
    mediaDir: join(root, 'media')
  };
  mkdirSync(p.mediaDir, { recursive: true });
  return p;
}
