/**
 * @highflame/overwatch-win32-x64
 * Platform-specific binaries for Windows x64
 */

const path = require('path');
const fs = require('fs');

const PLATFORM = 'win32';
const ARCH = 'x64';
const RUST_TARGET = 'x86_64-pc-windows-msvc';

function getRampartsBinaryPath() {
  const binaryName = `ramparts-${RUST_TARGET}.exe`;
  const binaryPath = path.join(__dirname, 'bin', binaryName);

  if (fs.existsSync(binaryPath)) {
    return binaryPath;
  }

  const genericPath = path.join(__dirname, 'bin', 'ramparts.exe');
  if (fs.existsSync(genericPath)) {
    return genericPath;
  }

  return null;
}

function isCurrentPlatform() {
  return process.platform === PLATFORM && process.arch === ARCH;
}

module.exports = {
  platform: PLATFORM,
  arch: ARCH,
  rustTarget: RUST_TARGET,
  getRampartsBinaryPath,
  isCurrentPlatform,
};
