{
  "type": "object",
  "additionalProperties": false,
  "x-transit-field-order": [
    "version",
    "definition",
    "code",
    "category",
    "stage",
    "outcome",
    "evidence",
    "message",
    "cause",
    "identity",
    "location",
    "facts",
    "actions"
  ],
  "properties": {
    "version": {
      "const": 1
    },
    "definition": {
      "type": "string",
      "enum": [
        "c7e556954e7f6e9cf79a65abf9d082372ea626174ca7a6b4422ae25083dffc8b"
      ]
    },
    "code": {
      "type": "string",
      "maxLength": 96,
      "x-transit-max-utf8-bytes": 96
    },
    "category": {
      "type": "string",
      "enum": [
        "syntax",
        "binding",
        "unsupported",
        "constraint",
        "access",
        "conflict",
        "limit",
        "lifecycle",
        "integrity",
        "unavailable",
        "internal"
      ]
    },
    "stage": {
      "type": "string",
      "enum": [
        "input",
        "parse",
        "compile",
        "bind",
        "prepare",
        "submit",
        "admission",
        "execute",
        "read",
        "decode",
        "output",
        "reconcile",
        "cleanup",
        "control"
      ]
    },
    "outcome": {
      "type": "string",
      "enum": [
        "not_applicable",
        "not_submitted",
        "not_dispatched",
        "prepared",
        "unknown",
        "pending",
        "input_rejected",
        "rejected",
        "applied",
        "completed",
        "failed",
        "cancelled",
        "retired",
        "closed_unknown"
      ]
    },
    "evidence": {
      "type": "string",
      "enum": [
        "none",
        "local_before_dispatch",
        "saved_intent",
        "native_receipt",
        "domain_status"
      ]
    },
    "message": {
      "type": "string",
      "maxLength": 384,
      "x-transit-max-utf8-bytes": 384
    },
    "cause": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 96,
          "x-transit-max-utf8-bytes": 96
        },
        {
          "type": "null"
        }
      ]
    },
    "identity": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "x-transit-field-order": [
            "domain",
            "id",
            "realm",
            "resource",
            "sequence"
          ],
          "properties": {
            "domain": {
              "type": "string",
              "enum": [
                "sql",
                "query",
                "mutation",
                "catalog",
                "application",
                "publication",
                "migration",
                "reactive",
                "serving",
                "effect",
                "exchange",
                "transport",
                "internal"
              ]
            },
            "id": {
              "type": "string",
              "maxLength": 20,
              "pattern": "^(0|[1-9][0-9]*)$"
            },
            "realm": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 20,
                  "pattern": "^(0|[1-9][0-9]*)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "resource": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 20,
                  "pattern": "^(0|[1-9][0-9]*)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "sequence": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 20,
                  "pattern": "^(0|[1-9][0-9]*)$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "domain",
            "id",
            "realm",
            "resource",
            "sequence"
          ],
          "x-transit-defaults": {
            "realm": null,
            "resource": null,
            "sequence": null
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "location": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "x-transit-field-order": [
            "source",
            "source_encoding",
            "source_truncated",
            "statement",
            "offset",
            "length",
            "line",
            "byte_column"
          ],
          "properties": {
            "source": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512,
                  "x-transit-max-utf8-bytes": 512
                },
                {
                  "type": "null"
                }
              ]
            },
            "source_encoding": {
              "type": "string",
              "enum": [
                "utf8",
                "escaped_bytes"
              ]
            },
            "source_truncated": {
              "type": "boolean"
            },
            "statement": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 20,
                  "pattern": "^(0|[1-9][0-9]*)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "offset": {
              "type": "string",
              "maxLength": 20,
              "pattern": "^(0|[1-9][0-9]*)$"
            },
            "length": {
              "type": "string",
              "maxLength": 20,
              "pattern": "^(0|[1-9][0-9]*)$"
            },
            "line": {
              "type": "string",
              "maxLength": 20,
              "pattern": "^(0|[1-9][0-9]*)$"
            },
            "byte_column": {
              "type": "string",
              "maxLength": 20,
              "pattern": "^(0|[1-9][0-9]*)$"
            }
          },
          "required": [
            "source",
            "source_encoding",
            "source_truncated",
            "statement",
            "offset",
            "length",
            "line",
            "byte_column"
          ],
          "x-transit-defaults": {
            "source": null,
            "source_encoding": "utf8",
            "source_truncated": false,
            "statement": null
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "facts": {
      "type": "array",
      "minItems": 16,
      "maxItems": 16,
      "items": {
        "anyOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "x-transit-field-order": [
              "field",
              "origin",
              "availability",
              "value"
            ],
            "properties": {
              "field": {
                "type": "string",
                "enum": [
                  "object",
                  "name",
                  "table",
                  "native_input",
                  "affected_rows",
                  "argument",
                  "option",
                  "permissions",
                  "scope",
                  "column",
                  "qualifier",
                  "constraint",
                  "key",
                  "input_row",
                  "first_occurrence",
                  "parameter",
                  "parameter_use",
                  "expected_count",
                  "actual_count",
                  "expected_type",
                  "actual_type",
                  "supplied_value",
                  "expected_value",
                  "expression",
                  "source_kind",
                  "source_basis",
                  "source_key",
                  "source_row",
                  "field_path",
                  "byte_offset",
                  "expected_resource",
                  "actual_resource",
                  "expected_source",
                  "actual_source",
                  "expected_revision",
                  "actual_revision",
                  "expected_schema",
                  "actual_schema",
                  "expected_policy",
                  "actual_policy",
                  "budget",
                  "limit",
                  "required",
                  "unit",
                  "completed_statements",
                  "emitted_rows",
                  "emitted_segments",
                  "completion",
                  "proposal",
                  "step",
                  "generation",
                  "attachment",
                  "lease",
                  "schema_origin",
                  "sampling_records",
                  "operation",
                  "native_cause",
                  "expected_bytes",
                  "presence",
                  "published",
                  "subscription",
                  "expected_codec",
                  "actual_codec",
                  "observed_clock",
                  "expected_namespace",
                  "actual_namespace",
                  "attempt",
                  "executor",
                  "resolution_reason",
                  "principal",
                  "deadline",
                  "authorization_policy",
                  "resolution_policy",
                  "protocol_status",
                  "native_effect",
                  "dependency",
                  "dependency_kind",
                  "dependency_owner"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "caller",
                  "execution",
                  "schema",
                  "authority",
                  "owner"
                ]
              },
              "availability": {
                "type": "string",
                "enum": [
                  "provided",
                  "truncated",
                  "unrecorded",
                  "unavailable",
                  "withheld",
                  "inapplicable"
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "text"
                        ],
                        "properties": {
                          "text": {
                            "type": "string",
                            "maxLength": 256,
                            "x-transit-max-utf8-bytes": 256
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "signed"
                        ],
                        "properties": {
                          "signed": {
                            "type": "string",
                            "maxLength": 20,
                            "pattern": "^(0|-?[1-9][0-9]*)$"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "unsigned"
                        ],
                        "properties": {
                          "unsigned": {
                            "type": "string",
                            "maxLength": 20,
                            "pattern": "^(0|[1-9][0-9]*)$"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "boolean"
                        ],
                        "properties": {
                          "boolean": {
                            "type": "boolean"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "digest"
                        ],
                        "properties": {
                          "digest": {
                            "type": "array",
                            "minItems": 32,
                            "maxItems": 32,
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 255,
                              "x-transit-bits": 8,
                              "x-transit-signed": false
                            }
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "location"
                        ],
                        "properties": {
                          "location": {
                            "type": "object",
                            "additionalProperties": false,
                            "x-transit-field-order": [
                              "source",
                              "source_encoding",
                              "source_truncated",
                              "statement",
                              "offset",
                              "length",
                              "line",
                              "byte_column"
                            ],
                            "properties": {
                              "source": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 512,
                                    "x-transit-max-utf8-bytes": 512
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "source_encoding": {
                                "type": "string",
                                "enum": [
                                  "utf8",
                                  "escaped_bytes"
                                ]
                              },
                              "source_truncated": {
                                "type": "boolean"
                              },
                              "statement": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 20,
                                    "pattern": "^(0|[1-9][0-9]*)$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "offset": {
                                "type": "string",
                                "maxLength": 20,
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "length": {
                                "type": "string",
                                "maxLength": 20,
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "line": {
                                "type": "string",
                                "maxLength": 20,
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "byte_column": {
                                "type": "string",
                                "maxLength": 20,
                                "pattern": "^(0|[1-9][0-9]*)$"
                              }
                            },
                            "required": [
                              "source",
                              "source_encoding",
                              "source_truncated",
                              "statement",
                              "offset",
                              "length",
                              "line",
                              "byte_column"
                            ],
                            "x-transit-defaults": {
                              "source": null,
                              "source_encoding": "utf8",
                              "source_truncated": false,
                              "statement": null
                            }
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "field",
              "origin",
              "availability",
              "value"
            ],
            "x-transit-defaults": {}
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "actions": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": {
        "anyOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "x-transit-field-order": [
              "kind",
              "target"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "correct_input",
                  "inspect_status",
                  "resume_exact",
                  "cancel_wait",
                  "cancel_mutation",
                  "refresh",
                  "recompile",
                  "retry_read",
                  "inspect_scope",
                  "reconcile_effect",
                  "contact_operator"
                ]
              },
              "target": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "x-transit-field-order": [
                      "domain",
                      "id",
                      "realm",
                      "resource",
                      "sequence"
                    ],
                    "properties": {
                      "domain": {
                        "type": "string",
                        "enum": [
                          "sql",
                          "query",
                          "mutation",
                          "catalog",
                          "application",
                          "publication",
                          "migration",
                          "reactive",
                          "serving",
                          "effect",
                          "exchange",
                          "transport",
                          "internal"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "maxLength": 20,
                        "pattern": "^(0|[1-9][0-9]*)$"
                      },
                      "realm": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 20,
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "resource": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 20,
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "sequence": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 20,
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "domain",
                      "id",
                      "realm",
                      "resource",
                      "sequence"
                    ],
                    "x-transit-defaults": {
                      "realm": null,
                      "resource": null,
                      "sequence": null
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "kind",
              "target"
            ],
            "x-transit-defaults": {
              "target": null
            }
          },
          {
            "type": "null"
          }
        ]
      }
    }
  },
  "required": [
    "version",
    "definition",
    "code",
    "category",
    "stage",
    "outcome",
    "evidence",
    "message",
    "cause",
    "identity",
    "location",
    "facts",
    "actions"
  ],
  "x-transit-defaults": {
    "cause": null,
    "identity": null,
    "location": null,
    "facts": [
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null
    ],
    "actions": [
      null,
      null,
      null,
      null
    ]
  }
}
