export const GUARDED_METHODS = new Set([
  "eth_requestAccounts",
  "wallet_requestPermissions",
  "wallet_switchEthereumChain",
  "wallet_addEthereumChain",
  "eth_sendTransaction",
  "eth_signTransaction",
  "personal_sign",
  "eth_sign",
  "eth_signTypedData",
  "eth_signTypedData_v3",
  "eth_signTypedData_v4",
  "wallet_sendCalls"
]);

export function actionForRisk(risk) {
  if (risk === "green") return "allow";
  if (risk === "red") return "block";
  return "confirm";
}

export function fallbackAnalysis(reason = "veersec_api_unavailable") {
  return {
    schema_version: "veersec_extension_request_analysis_v1",
    verdict: {
      risk: "grey",
      label: "VeerSec could not verify this transaction right now.",
      action: "confirm",
      requires_confirmation: true,
      requires_explicit_override: false,
      reasons: [reason, "Do not assume this contract is safe."]
    },
    privacy: {
      persisted_request_data: false,
      persisted_wallet_address: false,
      persisted_calldata: false,
      persisted_signature_or_message: false
    }
  };
}
