{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://moji.kaitoranma.com/docs/schemas/ingest-server-message.json",
  "title": "IngestServerMessage",
  "description": "Ingest（/v1/ingest）で文字おこしくんが送るメッセージを表す。",
  "oneOf": [
    {
      "$ref": "#/$defs/Welcome"
    },
    {
      "$ref": "#/$defs/Error"
    },
    {
      "$ref": "#/$defs/Pong"
    }
  ],
  "$defs": {
    "Welcome": {
      "title": "welcome",
      "description": "文字おこしくんは、hello を受け付けたことを welcome で知らせる。protocolVersion は、この接続で使うバージョンである。",
      "type": "object",
      "required": [
        "type",
        "protocolVersion",
        "sessionId"
      ],
      "properties": {
        "type": {
          "const": "welcome"
        },
        "protocolVersion": {
          "$ref": "common.json#/$defs/ProtocolVersion"
        },
        "sessionId": {
          "$ref": "common.json#/$defs/ServerId"
        }
      }
    },
    "Error": {
      "title": "error",
      "description": "文字おこしくんは、エラーを error で知らせる。trackId は、特定のトラックに関するエラーのときだけ付く。error.fatal が true なら、文字おこしくんはこの後に接続を切る。",
      "type": "object",
      "required": [
        "type",
        "error"
      ],
      "properties": {
        "type": {
          "const": "error"
        },
        "error": {
          "$ref": "common.json#/$defs/WireError"
        },
        "trackId": {
          "anyOf": [
            {
              "$ref": "common.json#/$defs/ServerId"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Pong": {
      "title": "pong",
      "description": "文字おこしくんは、ping に pong で応える。",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "pong"
        }
      }
    }
  }
}
