{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "deployment_id": {
      "pattern": "^dep_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "environment_id": {
      "pattern": "^env_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "findings": {
      "items": {
        "properties": {
          "code": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "exit_code": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "finding_id": {
            "pattern": "^fnd_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
            "type": "string"
          },
          "kind": {
            "enum": [
              "product",
              "environment",
              "isolation"
            ],
            "type": "string"
          },
          "message": {
            "maxLength": 2048,
            "type": "string"
          },
          "severity": {
            "enum": [
              "info",
              "warning",
              "error",
              "critical"
            ],
            "type": "string"
          },
          "stage": {
            "enum": [
              "apply",
              "startup",
              "health_check"
            ],
            "type": "string"
          }
        },
        "required": [
          "finding_id",
          "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"
    },
    "outcome": {
      "const": "stopped",
      "type": "string"
    },
    "phase": {
      "enum": [
        "apply",
        "startup",
        "health_check"
      ],
      "type": "string"
    },
    "pipeline_run_id": {
      "pattern": "^pipe_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "product_id": {
      "pattern": "^prod_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "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"
    },
    "revision_id": {
      "pattern": "^rev_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "slot": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string"
    },
    "workspace_id": {
      "pattern": "^ws_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    }
  },
  "required": [
    "deployment_id",
    "workspace_id",
    "product_id",
    "revision_id",
    "pipeline_run_id",
    "environment_id",
    "slot",
    "phase",
    "outcome",
    "isolation",
    "findings",
    "reported_at"
  ],
  "type": "object"
}
