/**
 * Street Cred Check
 *
 * Calculate an agent's Street Cred score with full breakdown.
 * Use this to gate agent interactions based on trust level.
 *
 * Run: npx ts-node examples/street-cred-check.ts
 */

import { VaultfireClient } from '@vaultfire/langchain';

async function main() {
  const client = new VaultfireClient({ chain: 'base' });

  const address = '0xA054f831B562e729F8D268291EBde1B2EDcFb84F';
  const cred = await client.getStreetCred(address);

  console.log(`Street Cred for ${address}`);
  console.log(`  Score: ${cred.score}/95`);
  console.log(`  Tier:  ${cred.tier}`);
  console.log(`  Breakdown:`);
  console.log(`    Identity Registered: ${cred.breakdown.identityRegistered}/30`);
  console.log(`    Has Bond:           ${cred.breakdown.hasBond}/25`);
  console.log(`    Bond Active:        ${cred.breakdown.bondActive}/15`);
  console.log(`    Bond Tier:          ${cred.breakdown.bondTier}/20`);
  console.log(`    Multiple Bonds:     ${cred.breakdown.multipleBonds}/5`);

  // Gate based on trust level
  if (cred.tier === 'platinum' || cred.tier === 'gold') {
    console.log('\n✓ Agent meets high-trust threshold — safe for financial operations');
  } else if (cred.tier === 'silver' || cred.tier === 'bronze') {
    console.log('\n⚠ Agent has basic trust — suitable for low-risk operations');
  } else {
    console.log('\n✗ Agent is unranked — verification recommended before interaction');
  }
}

main().catch(console.error);
