{
  "$defs": {
    "event": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "minLength": 1,
          "type": "string"
        },
        "owner": {
          "minLength": 1,
          "type": "string"
        },
        "payload": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name",
        "payload",
        "owner"
      ],
      "type": "object"
    },
    "factory": {
      "additionalProperties": false,
      "properties": {
        "input": {
          "type": "string"
        },
        "output": {
          "minLength": 1,
          "type": "string"
        },
        "scope": {
          "minLength": 1,
          "type": "string"
        },
        "signature": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "signature",
        "input",
        "output",
        "scope"
      ],
      "type": "object"
    },
    "gap": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "minLength": 1,
          "type": "string"
        },
        "publicMethod": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "enum": [
            "unavailable",
            "correction_required"
          ]
        }
      },
      "required": [
        "id",
        "status",
        "publicMethod"
      ],
      "type": "object"
    },
    "method": {
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "availability": {
                "enum": [
                  "unavailable",
                  "correction_required"
                ]
              }
            }
          },
          "then": {
            "required": [
              "correction"
            ]
          }
        }
      ],
      "properties": {
        "authority": {
          "enum": [
            "client",
            "shell_player",
            "platform",
            "world_server",
            "profile_dependent"
          ]
        },
        "availability": {
          "enum": [
            "available",
            "conditional",
            "unavailable",
            "correction_required"
          ]
        },
        "correction": {
          "type": "string"
        },
        "credentials": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "errors": {
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "idempotency": {
          "minLength": 1,
          "type": "string"
        },
        "input": {
          "type": "string"
        },
        "output": {
          "type": "string"
        },
        "profilePolicies": {
          "additionalProperties": {
            "$ref": "#/$defs/profilePolicy"
          },
          "type": "object"
        },
        "profiles": {
          "items": {
            "enum": [
              "client",
              "preview",
              "listen",
              "managed_server"
            ]
          },
          "type": "array",
          "uniqueItems": true
        },
        "receipt": {
          "minLength": 1,
          "type": "string"
        },
        "requiredCapabilities": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "runtimeBindings": {
          "additionalProperties": false,
          "properties": {
            "unreal": {
              "$ref": "#/$defs/runtimeBinding"
            },
            "web": {
              "$ref": "#/$defs/runtimeBinding"
            }
          },
          "required": [
            "web",
            "unreal"
          ],
          "type": "object"
        },
        "signature": {
          "minLength": 1,
          "type": "string"
        },
        "transportOwner": {
          "enum": [
            "local",
            "shell",
            "direct",
            "network_provider",
            "voice_provider"
          ]
        }
      },
      "required": [
        "signature",
        "input",
        "output",
        "availability",
        "profiles",
        "transportOwner",
        "authority",
        "requiredCapabilities",
        "credentials",
        "idempotency",
        "errors",
        "profilePolicies",
        "runtimeBindings"
      ],
      "type": "object"
    },
    "namespace": {
      "additionalProperties": false,
      "properties": {
        "handles": {
          "type": "object"
        },
        "methods": {
          "additionalProperties": {
            "$ref": "#/$defs/method"
          },
          "minProperties": 1,
          "type": "object"
        }
      },
      "required": [
        "methods"
      ],
      "type": "object"
    },
    "nonEmptyObject": {
      "minProperties": 1,
      "type": "object"
    },
    "profilePolicy": {
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "availability": {
                "enum": [
                  "unavailable",
                  "correction_required"
                ]
              }
            }
          },
          "then": {
            "required": [
              "correction"
            ]
          }
        }
      ],
      "properties": {
        "authority": {
          "enum": [
            "client",
            "shell_player",
            "platform",
            "world_server",
            "profile_dependent"
          ]
        },
        "availability": {
          "enum": [
            "available",
            "conditional",
            "unavailable",
            "correction_required"
          ]
        },
        "correction": {
          "minLength": 1,
          "type": "string"
        },
        "credentials": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "idempotency": {
          "minLength": 1,
          "type": "string"
        },
        "receipt": {
          "minLength": 1,
          "type": "string"
        },
        "requiredCapabilities": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        },
        "transportOwner": {
          "enum": [
            "local",
            "shell",
            "direct",
            "network_provider",
            "voice_provider"
          ]
        }
      },
      "required": [
        "availability",
        "transportOwner",
        "authority",
        "requiredCapabilities",
        "credentials",
        "idempotency"
      ],
      "type": "object"
    },
    "publicApi": {
      "additionalProperties": false,
      "properties": {
        "entryPoint": {
          "const": "src/index.ts"
        },
        "exports": {
          "items": {
            "$ref": "#/$defs/publicExport"
          },
          "minItems": 1,
          "type": "array"
        }
      },
      "required": [
        "entryPoint",
        "exports"
      ],
      "type": "object"
    },
    "publicExport": {
      "additionalProperties": false,
      "properties": {
        "category": {
          "enum": [
            "runtime_facade",
            "standalone_tooling",
            "multiplayer_handle_type",
            "implementation_symbol"
          ]
        },
        "declarations": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "declaration": {
                "minLength": 1,
                "type": "string"
              },
              "kind": {
                "minLength": 1,
                "type": "string"
              },
              "source": {
                "pattern": "^src/",
                "type": "string"
              }
            },
            "required": [
              "kind",
              "source",
              "declaration"
            ],
            "type": "object"
          },
          "minItems": 1,
          "type": "array"
        },
        "kind": {
          "enum": [
            "value",
            "type",
            "value_and_type"
          ]
        },
        "name": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name",
        "kind",
        "category",
        "declarations"
      ],
      "type": "object"
    },
    "runtimeBinding": {
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "availability": {
                "enum": [
                  "unavailable",
                  "correction_required"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "bindable": {
                "const": false
              }
            },
            "required": [
              "correction"
            ]
          }
        }
      ],
      "properties": {
        "availability": {
          "enum": [
            "available",
            "conditional",
            "unavailable",
            "correction_required"
          ]
        },
        "bindable": {
          "type": "boolean"
        },
        "correction": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "availability",
        "bindable"
      ],
      "type": "object"
    }
  },
  "$id": "https://helixgame.com/schemas/runtime-contract.known-answer.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "const": "./known-answer.schema.json"
    },
    "authorityProfiles": {
      "$ref": "#/$defs/nonEmptyObject"
    },
    "availabilityMeanings": {
      "$ref": "#/$defs/nonEmptyObject"
    },
    "capabilities": {
      "type": "object"
    },
    "contractVersion": {
      "minimum": 1,
      "type": "integer"
    },
    "digest": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "type": "string"
    },
    "events": {
      "items": {
        "$ref": "#/$defs/event"
      },
      "type": "array"
    },
    "knownGaps": {
      "items": {
        "$ref": "#/$defs/gap"
      },
      "type": "array"
    },
    "methodIndex": {
      "additionalProperties": {
        "$ref": "#/$defs/method"
      },
      "minProperties": 1,
      "type": "object"
    },
    "multiplayerContractVersion": {
      "minimum": 1,
      "type": "integer"
    },
    "namespaces": {
      "additionalProperties": {
        "$ref": "#/$defs/namespace"
      },
      "minProperties": 1,
      "type": "object"
    },
    "protocolVersion": {
      "minimum": 1,
      "type": "integer"
    },
    "publicApi": {
      "$ref": "#/$defs/publicApi"
    },
    "purchaseStatusMeanings": {
      "$ref": "#/$defs/nonEmptyObject"
    },
    "schema": {
      "const": "helix.runtime-contract"
    },
    "sdk": {
      "additionalProperties": false,
      "properties": {
        "multiplayerContractVersion": {
          "minimum": 1,
          "type": "integer"
        },
        "package": {
          "type": "string"
        },
        "packageVersion": {
          "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+",
          "type": "string"
        },
        "protocolVersion": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "package",
        "packageVersion",
        "protocolVersion",
        "multiplayerContractVersion"
      ],
      "type": "object"
    },
    "source": {
      "additionalProperties": false,
      "properties": {
        "branch": {
          "minLength": 1,
          "type": "string"
        },
        "commit": {
          "pattern": "^[0-9a-f]{40}$",
          "type": "string"
        },
        "fileDigests": {
          "$comment": "sha256 of every audited source file, as it must exist on disk. This is what the contract is an audit OF. `commit` is provenance only: a commit pin cannot survive a squash merge, and its failure lands on the integration branch rather than in the PR that caused it.",
          "additionalProperties": {
            "pattern": "^sha256:[0-9a-f]{64}$",
            "type": "string"
          },
          "minProperties": 1,
          "type": "object"
        },
        "repository": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "repository",
        "branch",
        "commit",
        "fileDigests"
      ],
      "type": "object"
    },
    "sourceCommit": {
      "pattern": "^[0-9a-f]{40}$",
      "type": "string"
    },
    "stableErrors": {
      "$ref": "#/$defs/nonEmptyObject"
    },
    "standaloneFactories": {
      "additionalProperties": {
        "$ref": "#/$defs/factory"
      },
      "minProperties": 1,
      "type": "object"
    },
    "types": {
      "type": "object"
    }
  },
  "required": [
    "schema",
    "contractVersion",
    "source",
    "sdk",
    "authorityProfiles",
    "capabilities",
    "availabilityMeanings",
    "stableErrors",
    "purchaseStatusMeanings",
    "events",
    "types",
    "publicApi",
    "namespaces",
    "standaloneFactories",
    "knownGaps",
    "$schema",
    "digest",
    "methodIndex",
    "protocolVersion",
    "multiplayerContractVersion",
    "sourceCommit"
  ],
  "title": "HELIX runtime contract cross-runtime known answer",
  "type": "object"
}
