import os from 'node:os';

export interface DeviceFingerprint {
  hostname: string;
  os: string;
  osVersion: string;
}

const OS_NAMES: Record<string, string> = {
  win32: 'windows',
  darwin: 'macos',
  linux: 'linux',
};

export function detectDevice(): DeviceFingerprint {
  return {
    hostname: os.hostname(),
    os: OS_NAMES[process.platform] ?? process.platform,
    osVersion: os.release(),
  };
}
