{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wallet-profile-orpin.vercel.app/schemas/walletAnalysisResult.schema.json",
  "title": "WalletAnalysisResult",
  "description": "Structured wallet reputation analysis returned by OnFRA.",
  "type": "object",
  "required": ["status", "walletAddress", "financialHealthScore", "reputationScore"],
  "properties": {
    "status": {
      "type": "string",
      "enum": ["completed", "processing", "failed"]
    },
    "walletAddress": {
      "type": "string",
      "pattern": "^0x[a-fA-F0-9]{40}$"
    },
    "ens": {
      "type": ["string", "null"]
    },
    "financialHealthScore": {
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "financialHealthBreakdown": {
      "type": "object",
      "properties": {
        "incomeStability": { "type": "number" },
        "savingsDiscipline": { "type": "number" },
        "portfolioRisk": { "type": "number" },
        "spendingDiscipline": { "type": "number" },
        "walletMaturity": { "type": "number" },
        "debtRiskSignals": { "type": "number" }
      }
    },
    "reputationScore": {
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "reputationCategory": { "type": "string" },
    "riskCategory": { "type": "string" },
    "incomeLabel": { "type": "string" },
    "loanRange": { "type": "string" },
    "loanConfidence": { "type": "string" },
    "aiDashboardSummary": { "type": "string" },
    "aiAttestation": { "type": "string" },
    "threeMonthStatement": {
      "type": "object",
      "properties": {
        "totalInflowUsd": { "type": "number" },
        "totalOutflowUsd": { "type": "number" },
        "netFlowUsd": { "type": "number" },
        "transactionCount": { "type": "integer" }
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": true
}
