{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "StorageOps",
  "anyOf": [
    {
      "description": "Create new collection and (optionally) specify index params",
      "type": "object",
      "required": [
        "create_collection"
      ],
      "properties": {
        "create_collection": {
          "type": "object",
          "required": [
            "distance",
            "name",
            "vector_size"
          ],
          "properties": {
            "distance": {
              "$ref": "#/definitions/Distance"
            },
            "index": {
              "anyOf": [
                {
                  "$ref": "#/definitions/Indexes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "name": {
              "type": "string"
            },
            "vector_size": {
              "type": "integer",
              "format": "uint",
              "minimum": 0.0
            }
          }
        }
      }
    },
    {
      "description": "Delete collection with given name",
      "type": "object",
      "required": [
        "delete_collection"
      ],
      "properties": {
        "delete_collection": {
          "type": "string"
        }
      }
    },
    {
      "description": "Perform changes of collection aliases",
      "type": "object",
      "required": [
        "change_aliases"
      ],
      "properties": {
        "change_aliases": {
          "type": "object",
          "required": [
            "actions"
          ],
          "properties": {
            "actions": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/AliasOperations"
              }
            }
          }
        }
      }
    }
  ],
  "definitions": {
    "AliasOperations": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "create_alias"
          ],
          "properties": {
            "create_alias": {
              "type": "object",
              "required": [
                "alias_name",
                "collection_name"
              ],
              "properties": {
                "alias_name": {
                  "type": "string"
                },
                "collection_name": {
                  "type": "string"
                }
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "delete_alias"
          ],
          "properties": {
            "delete_alias": {
              "type": "object",
              "required": [
                "alias_name"
              ],
              "properties": {
                "alias_name": {
                  "type": "string"
                }
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "rename_alias"
          ],
          "properties": {
            "rename_alias": {
              "type": "object",
              "required": [
                "new_alias_name",
                "old_alias_name"
              ],
              "properties": {
                "new_alias_name": {
                  "type": "string"
                },
                "old_alias_name": {
                  "type": "string"
                }
              }
            }
          }
        }
      ]
    },
    "Distance": {
      "description": "Type of internal tags, build from payload",
      "type": "string",
      "enum": [
        "Cosine",
        "Euclid",
        "Dot",
        "Manhattan"
      ]
    },
    "Indexes": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "options",
            "type"
          ],
          "properties": {
            "options": {
              "type": "object"
            },
            "type": {
              "type": "string",
              "enum": [
                "plain"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "options",
            "type"
          ],
          "properties": {
            "options": {
              "type": "object",
              "required": [
                "ef_construct",
                "m"
              ],
              "properties": {
                "ef_construct": {
                  "type": "integer",
                  "format": "uint",
                  "minimum": 0.0
                },
                "m": {
                  "type": "integer",
                  "format": "uint",
                  "minimum": 0.0
                }
              }
            },
            "type": {
              "type": "string",
              "enum": [
                "hnsw"
              ]
            }
          }
        }
      ]
    }
  }
}