/**
 * @highflame/overwatch-darwin-arm64
 * Platform-specific binaries for macOS ARM64 (Apple Silicon)
 */

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

const PLATFORM = 'darwin';
const ARCH = 'arm64';
const RUST_TARGET = 'aarch64-apple-darwin';

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

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

  const genericPath = path.join(__dirname, 'bin', 'ramparts');
  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,
};
