{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/once-app/json-schema/once-app-fraud-score-response-schema.json",
  "title": "FraudScoreResponse",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/once-app-openapi.json#/components/schemas/FraudScoreResponse",
  "type": "object",
  "required": [
    "email",
    "score",
    "maxScore",
    "severity",
    "flags"
  ],
  "properties": {
    "email": {
      "type": "string",
      "format": "email"
    },
    "score": {
      "type": "integer",
      "description": "Overall weighted risk score, 0..maxScore."
    },
    "maxScore": {
      "type": "integer",
      "description": "Scoring ceiling."
    },
    "severity": {
      "type": "string",
      "enum": [
        "none",
        "low",
        "medium",
        "high",
        "critical"
      ]
    },
    "computedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Last time this account was scored, or null if never scored."
    },
    "flags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FraudFlag"
      }
    }
  },
  "$defs": {
    "FraudFlag": {
      "type": "object",
      "required": [
        "code",
        "label",
        "category",
        "severity",
        "triggered",
        "points"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable public flag code."
        },
        "label": {
          "type": "string"
        },
        "category": {
          "type": "string",
          "enum": [
            "rights",
            "account_integrity",
            "content",
            "distribution",
            "streaming",
            "behavior",
            "abuse"
          ]
        },
        "severity": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high",
            "critical"
          ]
        },
        "triggered": {
          "type": "boolean"
        },
        "points": {
          "type": "integer",
          "description": "Points this flag contributed (0 when not triggered)."
        }
      }
    }
  }
}