{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-create-saved-search-body-schema.json",
  "title": "CreateSavedSearchBody",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/latitude-so-saved-searches-api-openapi.yml#/components/schemas/CreateSavedSearchBody",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Human-readable name. Used to derive the slug."
    },
    "query": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 500,
      "default": null,
      "description": "Free-text semantic query. `null` (default) when the search is filter-only. At least one of `query` or `filters` must be set."
    },
    "filters": {
      "allOf": [
        {
          "$ref": "#/$defs/FilterSet"
        },
        {
          "description": "Structured filter set. Defaults to `{}` (no filters). At least one of `query` or `filters` must be set."
        }
      ]
    }
  },
  "required": [
    "name"
  ],
  "$defs": {
    "FilterCondition": {
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "eq",
            "neq",
            "gt",
            "gte",
            "lt",
            "lte",
            "in",
            "notIn",
            "contains",
            "notContains",
            "gtePercentile"
          ],
          "description": "Comparison operator applied to the field's value (e.g. `eq`, `neq`, `in`). The full operator list lives in the API reference."
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  }
                ]
              }
            }
          ],
          "description": "Right-hand value compared against the field. Arrays are required for `in` / `notIn`-style operators."
        }
      },
      "required": [
        "op",
        "value"
      ]
    },
    "FilterSet": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/FilterCondition"
        }
      },
      "description": "Filter set keyed by field name. Each entry holds an array of conditions ANDed together for that field; field-level groups are also ANDed across the set."
    }
  }
}