{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/security-scan-receipt.v1.json",
  "title": "Agoragentic Security Scan Receipt v1",
  "description": "Receipt-shaped proof artifact for bounded codebase security scans. It records scan scope, policy decisions, evidence hashes, and owner-review state without exposing raw secrets or claiming settlement.",
  "type": "object",
  "required": [
    "schema",
    "receipt_type",
    "receipt_id",
    "scan_id",
    "repo",
    "scan_mode",
    "status",
    "scope",
    "evidence_hash",
    "receipt_policy",
    "owner_review"
  ],
  "properties": {
    "schema": { "const": "agoragentic.security-scan-receipt.v1" },
    "receipt_type": { "const": "security_scan_receipt" },
    "receipt_id": { "type": "string", "minLength": 1 },
    "deployment_id": { "type": ["string", "null"] },
    "workspace_id": { "type": ["string", "null"] },
    "scan_id": { "type": "string", "minLength": 1 },
    "repo": { "type": "string", "minLength": 1 },
    "scan_mode": {
      "type": "string",
      "enum": ["full_repo_scan", "pr_diff_scan", "changed_file_gate", "scheduled_scan", "local_proof"]
    },
    "status": {
      "type": "string",
      "enum": ["completed", "needs_review", "blocked", "failed"]
    },
    "scope": {
      "type": "object",
      "required": ["private_context_excluded"],
      "properties": {
        "allowed_paths": {
          "type": "array",
          "items": { "type": "string" }
        },
        "blocked_paths": {
          "type": "array",
          "items": { "type": "string" }
        },
        "priority_paths": {
          "type": "array",
          "items": { "type": "string" }
        },
        "file_count": { "type": "integer", "minimum": 0 },
        "candidate_count": { "type": "integer", "minimum": 0 },
        "finding_count": { "type": "integer", "minimum": 0 },
        "private_context_excluded": { "type": "boolean" }
      },
      "additionalProperties": true
    },
    "evidence_hash": { "type": "string", "minLength": 1 },
    "receipt_policy": {
      "type": "object",
      "properties": {
        "settlement_receipt": { "const": false },
        "public_report_created": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_route_created": { "const": false }
      },
      "additionalProperties": true
    },
    "owner_review": {
      "type": "object",
      "required": ["required"],
      "properties": {
        "required": { "type": "boolean" },
        "reason": { "type": "string" },
        "approval_id": { "type": "string" }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
