{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "deployment_id": {
      "pattern": "^dep_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "execution_id": {
      "pattern": "^exe_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "findings": {
      "items": {
        "properties": {
          "code": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "kind": {
            "enum": [
              "product",
              "runtime",
              "isolation"
            ],
            "type": "string"
          },
          "message": {
            "maxLength": 2048,
            "type": "string"
          },
          "severity": {
            "enum": [
              "info",
              "warning",
              "error",
              "critical"
            ],
            "type": "string"
          }
        },
        "required": [
          "kind",
          "severity",
          "code",
          "message"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "isolation": {
      "properties": {
        "enforced": {
          "type": "boolean"
        },
        "profile": {
          "enum": [
            "isolated-vm",
            "isolated-kernel",
            "trusted"
          ],
          "type": "string"
        }
      },
      "required": [
        "profile",
        "enforced"
      ],
      "type": "object"
    },
    "log_evidence": {
      "anyOf": [
        {
          "properties": {
            "sha256": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            },
            "size_bytes": {
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            "uri": {
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "uri",
            "sha256",
            "size_bytes"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "reported_at": {
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "type": "string"
    },
    "request_event_id": {
      "pattern": "^evt_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "response": {
      "anyOf": [
        {
          "properties": {
            "body_evidence": {
              "anyOf": [
                {
                  "properties": {
                    "sha256": {
                      "pattern": "^[0-9a-f]{64}$",
                      "type": "string"
                    },
                    "size_bytes": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "uri": {
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "uri",
                    "sha256",
                    "size_bytes"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "headers": {
              "additionalProperties": {
                "maxLength": 4096,
                "type": "string"
              },
              "default": {},
              "propertyNames": {
                "pattern": "^(?:content-type|content-encoding|content-language|cache-control|etag|last-modified|location|vary)$",
                "type": "string"
              },
              "type": "object"
            },
            "http_status": {
              "anyOf": [
                {
                  "maximum": 599,
                  "minimum": 100,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "http_status",
            "body_evidence"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "started_at": {
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "type": "string"
    },
    "status": {
      "enum": [
        "responded",
        "error",
        "timed_out",
        "isolation_blocked"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cpu_ms": {
          "anyOf": [
            {
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "duration_ms": {
          "maximum": 9007199254740991,
          "minimum": 0,
          "type": "integer"
        },
        "memory_peak_bytes": {
          "anyOf": [
            {
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "duration_ms",
        "cpu_ms",
        "memory_peak_bytes"
      ],
      "type": "object"
    },
    "workspace_id": {
      "pattern": "^ws_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    }
  },
  "required": [
    "execution_id",
    "request_event_id",
    "workspace_id",
    "deployment_id",
    "isolation",
    "status",
    "response",
    "log_evidence",
    "usage",
    "findings",
    "started_at",
    "reported_at"
  ],
  "type": "object"
}
