{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "personas": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "version": {
            "const": "ridley.persona/1",
            "type": "string"
          },
          "personaId": {
            "type": "string"
          },
          "profileId": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "revision": {
            "type": "number"
          },
          "createdAt": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "description": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "instructions": {
                "type": "string"
              },
              "knowledge": {
                "type": "string"
              },
              "speakingStyle": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "allowedTopics": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "forbiddenTopics": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "emotionalBaseline": {
                "type": "string"
              },
              "memory": {
                "anyOf": [
                  {
                    "const": "none",
                    "type": "string"
                  },
                  {
                    "const": "session",
                    "type": "string"
                  }
                ]
              },
              "maxTurns": {
                "type": "number"
              },
              "maxHistoryChars": {
                "type": "number"
              }
            },
            "required": [
              "name",
              "role",
              "instructions",
              "knowledge",
              "speakingStyle",
              "language",
              "allowedTopics",
              "forbiddenTopics",
              "emotionalBaseline",
              "memory",
              "maxTurns",
              "maxHistoryChars"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "personaId",
          "profileId",
          "parentId",
          "revision",
          "createdAt",
          "sha256",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "npcs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "actor": {
            "type": "string"
          },
          "profileId": {
            "type": "string"
          }
        },
        "required": ["actor", "profileId"],
        "additionalProperties": false
      }
    },
    "audio": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "version": {
            "const": "ridley.audio/1",
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          },
          "byteLength": {
            "type": "number"
          },
          "mediaType": {
            "anyOf": [
              { "const": "audio/wav", "type": "string" },
              { "const": "audio/mpeg", "type": "string" }
            ]
          },
          "durationSeconds": {
            "type": "number"
          },
          "sampleRate": {
            "type": "number"
          },
          "channels": {
            "anyOf": [
              {
                "const": 1,
                "type": "number"
              },
              {
                "const": 2,
                "type": "number"
              }
            ]
          }
        },
        "required": [
          "version",
          "assetId",
          "displayName",
          "sha256",
          "uri",
          "byteLength",
          "mediaType",
          "durationSeconds",
          "sampleRate",
          "channels"
        ],
        "additionalProperties": false
      }
    },
    "schema": {
      "const": "quay.experience",
      "type": "string"
    },
    "version": {
      "const": "1.0.0",
      "type": "string"
    },
    "compiler": {
      "const": "ridley.experience/1",
      "type": "string"
    },
    "worldSceneId": {
      "type": "string"
    },
    "worldSourceHash": {
      "type": "string"
    },
    "sourceHash": {
      "type": "string"
    },
    "bindings": {
      "type": "object",
      "properties": {},
      "required": [],
      "additionalProperties": {
        "type": "string"
      }
    },
    "initial": {
      "type": "string"
    },
    "states": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "audio": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "action": {
                  "anyOf": [
                    {
                      "const": "play",
                      "type": "string"
                    },
                    {
                      "const": "stop",
                      "type": "string"
                    },
                    {
                      "const": "crossfade",
                      "type": "string"
                    }
                  ]
                },
                "assetId": {
                  "type": "string"
                },
                "from": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "volume": {
                  "type": "number"
                },
                "fade": {
                  "type": "number"
                },
                "loop": {
                  "anyOf": [
                    {
                      "const": false,
                      "type": "boolean"
                    },
                    {
                      "const": true,
                      "type": "boolean"
                    }
                  ]
                }
              },
              "required": [
                "action",
                "assetId",
                "from",
                "volume",
                "fade",
                "loop"
              ],
              "additionalProperties": false
            }
          },
          "id": {
            "type": "string"
          },
          "mode": {
            "anyOf": [
              {
                "const": "interactive",
                "type": "string"
              },
              {
                "const": "cinematic",
                "type": "string"
              },
              {
                "const": "conversation",
                "type": "string"
              }
            ]
          },
          "conversation": {
            "type": "object",
            "properties": {
              "actor": {
                "type": "string"
              },
              "profileId": {
                "type": "string"
              }
            },
            "required": ["actor", "profileId"],
            "additionalProperties": false
          },
          "cinematic": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "control": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "camera": {
            "anyOf": [
              {
                "const": "third-person",
                "type": "string"
              },
              {
                "const": "first-person",
                "type": "string"
              },
              {
                "const": "overhead",
                "type": "string"
              },
              {
                "const": "overview",
                "type": "string"
              }
            ]
          },
          "userCamera": {
            "anyOf": [
              {
                "const": false,
                "type": "boolean"
              },
              {
                "const": true,
                "type": "boolean"
              }
            ]
          },
          "followers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "actor": {
                  "type": "string"
                },
                "target": {
                  "type": "string"
                },
                "distance": {
                  "type": "number"
                },
                "delay": {
                  "type": "number"
                },
                "speed": {
                  "type": "number"
                }
              },
              "required": ["actor", "target", "distance", "delay", "speed"],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "mode",
          "cinematic",
          "control",
          "camera",
          "userCamera",
          "followers"
        ],
        "additionalProperties": false
      }
    },
    "transitions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "subject": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "target": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "once": {
            "anyOf": [
              {
                "const": false,
                "type": "boolean"
              },
              {
                "const": true,
                "type": "boolean"
              }
            ]
          }
        },
        "required": ["id", "from", "to", "event", "subject", "target", "once"],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schema",
    "version",
    "compiler",
    "worldSceneId",
    "worldSourceHash",
    "sourceHash",
    "bindings",
    "initial",
    "states",
    "transitions"
  ],
  "additionalProperties": false
}
