{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/viridi-parente/main/json-schema/viridi-parente-entity-view-search-query-schema.json",
  "title": "EntityViewSearchQuery",
  "description": "The entity view search query JSON",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/viridi-parente-entity-view-controller-api-openapi.yml#/components/schemas/EntityViewSearchQuery",
  "properties": {
    "parameters": {
      "$ref": "#/$defs/RelationsSearchParameters",
      "description": "Main search parameters."
    },
    "relationType": {
      "type": "string",
      "description": "Type of the relation between root entity and device (e.g. 'Contains' or 'Manages')."
    },
    "entityViewTypes": {
      "type": "array",
      "description": "Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor').",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "RelationsSearchParameters": {
      "properties": {
        "rootId": {
          "type": "string",
          "format": "uuid",
          "description": "Root entity id to start search from."
        },
        "rootType": {
          "type": "string",
          "description": "Type of the root entity.",
          "enum": [
            "TENANT",
            "CUSTOMER",
            "USER",
            "DASHBOARD",
            "ASSET",
            "DEVICE",
            "ALARM",
            "RULE_CHAIN",
            "RULE_NODE",
            "ROLE",
            "ENTITY_VIEW",
            "WIDGETS_BUNDLE",
            "WIDGET_TYPE",
            "TENANT_PROFILE",
            "DEVICE_PROFILE",
            "ASSET_PROFILE",
            "API_USAGE_STATE",
            "TB_RESOURCE",
            "OTA_PACKAGE",
            "EDGE",
            "RPC",
            "QUEUE",
            "NOTIFICATION_TARGET",
            "NOTIFICATION_TEMPLATE",
            "NOTIFICATION_REQUEST",
            "NOTIFICATION",
            "NOTIFICATION_RULE",
            "QUEUE_STATS"
          ]
        },
        "direction": {
          "type": "string",
          "description": "Type of the root entity.",
          "enum": [
            "FROM",
            "TO"
          ]
        },
        "relationTypeGroup": {
          "type": "string",
          "description": "Type of the relation.",
          "enum": [
            "COMMON",
            "DASHBOARD",
            "RULE_CHAIN",
            "RULE_NODE",
            "EDGE",
            "EDGE_AUTO_ASSIGN_RULE_CHAIN"
          ]
        },
        "maxLevel": {
          "type": "integer",
          "format": "int32",
          "description": "Maximum level of the search depth."
        },
        "fetchLastLevelOnly": {
          "type": "boolean",
          "description": "Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity."
        }
      }
    }
  }
}