// ABI lookup map for contracts.ts
// Maps contract names to their ABIs for each chain

import { MissionEnforcement_ABI } from './MissionEnforcement';
import { AntiSurveillance_ABI } from './AntiSurveillance';
import { PrivacyGuarantees_ABI } from './PrivacyGuarantees';
import { ERC8004IdentityRegistry_ABI } from './ERC8004IdentityRegistry';
import { BeliefAttestationVerifier_ABI } from './BeliefAttestationVerifier';
import { AIPartnershipBondsV2_ABI } from './AIPartnershipBondsV2';
import { FlourishingMetricsOracle_ABI } from './FlourishingMetricsOracle';
import { AIAccountabilityBondsV2_ABI } from './AIAccountabilityBondsV2';
import { ERC8004ReputationRegistry_ABI } from './ERC8004ReputationRegistry';
import { ERC8004ValidationRegistry_ABI } from './ERC8004ValidationRegistry';
import { VaultfireERC8004Adapter_ABI } from './VaultfireERC8004Adapter';
import { MultisigGovernance_ABI } from './MultisigGovernance';
import { ProductionBeliefAttestationVerifier_ABI } from './ProductionBeliefAttestationVerifier';
import { DilithiumAttestor_ABI } from './DilithiumAttestor';
import { VaultfireTeleporterBridge_ABI } from './VaultfireTeleporterBridge';
import { TrustDataBridge_ABI } from './TrustDataBridge';
import { VaultfireNameService_ABI } from './VaultfireNameService';
import { VaultfireTrustAttestation_ABI } from './VaultfireTrustAttestation';
// v2.0: Chain-specific ABI imports for the 4 previously missing ABIs (41→45)
import { BeliefAttestationVerifier_base_ABI } from './base_BeliefAttestationVerifier';
import { DilithiumAttestor_base_ABI } from './base_DilithiumAttestor';
import { ERC8004ReputationRegistry_base_ABI } from './base_ERC8004ReputationRegistry';
import { ERC8004ValidationRegistry_avalanche_ABI } from './avalanche_ERC8004ValidationRegistry';
import { VaultfireTaskEscrow_ABI } from './VaultfireTaskEscrow';
import { VKPSessionKeyManager_ABI } from './VKPSessionKeyManager';
import { VKPDelegationRegistry_ABI } from './VKPDelegationRegistry';
import { VKPFactory_ABI } from './VKPFactory';
import { VaultfireReputationStaking_ABI } from './VaultfireReputationStaking';
import { VaultfireTrustOracle_ABI } from './VaultfireTrustOracle';
import { VaultfireBondInsurancePool_ABI } from './VaultfireBondInsurancePool';
import { VaultfireCapabilityCredentials_ABI } from './VaultfireCapabilityCredentials';
import { VaultfireDisputeResolution_ABI } from './VaultfireDisputeResolution';
// v3.0: New v2 contracts (127 total)
import { AgentInsurancePool_ABI } from './AgentInsurancePool';
// v3.1: VaultfireStreetCred (Sprint 2) — ERC-5192 soulbound badge
import { VaultfireStreetCred_ABI } from './VaultfireStreetCred';
// v3.2: VaultfireBIPVault (Sprint 3) — ERC-4626 view adapter
import { VaultfireBIPVault_ABI } from './VaultfireBIPVault';
// v3.3: VaultfireBatchOnboarder (Sprint 1) — EIP-7702 stateless delegate
import { VaultfireBatchOnboarder_ABI } from './VaultfireBatchOnboarder';
// v3.3: VaultfireForumRegistry — XMTP V3 MLS group registry, deployed on all 4 chains
import { VaultfireForumRegistry_ABI } from './VaultfireForumRegistry';
import { AgentSafetyManager_ABI } from './AgentSafetyManager';
import { ComplianceRegistry_ABI } from './ComplianceRegistry';
import { ReputationDecay_ABI } from './ReputationDecay';
import { ScopedDelegation_ABI } from './ScopedDelegation';
import { AgentSLAEnforcer_ABI } from './AgentSLAEnforcer';

/** Lookup table: contract name → ABI array */
export const ABI_MAP: Record<string, readonly any[]> = {
  MissionEnforcement: MissionEnforcement_ABI,
  AntiSurveillance: AntiSurveillance_ABI,
  PrivacyGuarantees: PrivacyGuarantees_ABI,
  ERC8004IdentityRegistry: ERC8004IdentityRegistry_ABI,
  BeliefAttestationVerifier: BeliefAttestationVerifier_ABI,
  AIPartnershipBondsV2: AIPartnershipBondsV2_ABI,
  FlourishingMetricsOracle: FlourishingMetricsOracle_ABI,
  AIAccountabilityBondsV2: AIAccountabilityBondsV2_ABI,
  ERC8004ReputationRegistry: ERC8004ReputationRegistry_ABI,
  ERC8004ValidationRegistry: ERC8004ValidationRegistry_ABI,
  VaultfireERC8004Adapter: VaultfireERC8004Adapter_ABI,
  MultisigGovernance: MultisigGovernance_ABI,
  ProductionBeliefAttestationVerifier: ProductionBeliefAttestationVerifier_ABI,
  DilithiumAttestor: DilithiumAttestor_ABI,
  VaultfireTeleporterBridge: VaultfireTeleporterBridge_ABI,
  TrustDataBridge: TrustDataBridge_ABI,
  VaultfireNameService: VaultfireNameService_ABI,
  VaultfireTrustAttestation: VaultfireTrustAttestation_ABI,
  // v2.0: Chain-specific overrides for contracts with different ABIs per chain
  'BeliefAttestationVerifier_base': BeliefAttestationVerifier_base_ABI,
  'DilithiumAttestor_base': DilithiumAttestor_base_ABI,
  'ERC8004ReputationRegistry_base': ERC8004ReputationRegistry_base_ABI,
  'ERC8004ValidationRegistry_avalanche': ERC8004ValidationRegistry_avalanche_ABI,
  VaultfireTaskEscrow: VaultfireTaskEscrow_ABI,
  VKPSessionKeyManager: VKPSessionKeyManager_ABI,
  VKPDelegationRegistry: VKPDelegationRegistry_ABI,
  VKPFactory: VKPFactory_ABI,
  VaultfireReputationStaking: VaultfireReputationStaking_ABI,
  VaultfireTrustOracle: VaultfireTrustOracle_ABI,
  VaultfireBondInsurancePool: VaultfireBondInsurancePool_ABI,
  VaultfireCapabilityCredentials: VaultfireCapabilityCredentials_ABI,
  VaultfireDisputeResolution: VaultfireDisputeResolution_ABI,
  // v3.0: New v2 contracts
  AgentInsurancePool: AgentInsurancePool_ABI,
  AgentSafetyManager: AgentSafetyManager_ABI,
  ComplianceRegistry: ComplianceRegistry_ABI,
  ReputationDecay: ReputationDecay_ABI,
  ScopedDelegation: ScopedDelegation_ABI,
  AgentSLAEnforcer: AgentSLAEnforcer_ABI,
  // v3.1: ERC-5192 soulbound reputation badge (Base, Sprint 2)
  VaultfireStreetCred: VaultfireStreetCred_ABI,
  // v3.2: ERC-4626 view adapter over the Bond Insurance Pool (Base, Sprint 3)
  VaultfireBIPVault: VaultfireBIPVault_ABI,
  // v3.3: EIP-7702 stateless delegate for one-sig register + bond (Base, Sprint 1)
  VaultfireBatchOnboarder: VaultfireBatchOnboarder_ABI,
  // v3.3: ForumRegistry — XMTP V3 MLS group registry (Base, Avax, Arb, Polygon)
  VaultfireForumRegistry: VaultfireForumRegistry_ABI,
};

/** Get ABI for a contract by name. Returns empty array if not found. */
export function getABI(contractName: string): readonly any[] {
  return ABI_MAP[contractName] ?? [];
}
