{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/harness/main/json-schema/harness-perspective-query-dto-schema.json",
  "title": "PerspectiveQueryDTO",
  "description": "The query object for perspective cost anomalies",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/harness-anomalies-api-openapi.yml#/components/schemas/PerspectiveQueryDTO",
  "type": "object",
  "properties": {
    "filters": {
      "type": "array",
      "description": "The filters for perspective query",
      "items": {
        "$ref": "#/$defs/QLCEViewFilterWrapper"
      }
    },
    "groupBy": {
      "type": "array",
      "description": "The group by clause for perspective query",
      "items": {
        "$ref": "#/$defs/QLCEViewGroupBy"
      }
    }
  },
  "$defs": {
    "QLCEViewFieldInput": {
      "type": "object",
      "properties": {
        "fieldId": {
          "type": "string"
        },
        "fieldName": {
          "type": "string"
        },
        "identifier": {
          "type": "string",
          "description": "Perspective filter Category, CLUSTER means Kubernetes",
          "enum": [
            "CLUSTER",
            "AWS",
            "GCP",
            "AZURE",
            "OPENAI",
            "ANTHROPIC",
            "AI",
            "AI_TRACE",
            "EXTERNAL_DATA",
            "COMMON",
            "CUSTOM",
            "BUSINESS_MAPPING",
            "LABEL",
            "LABEL_V2"
          ]
        },
        "identifierName": {
          "type": "string"
        }
      }
    },
    "QLCEViewFilter": {
      "type": "object",
      "properties": {
        "field": {
          "$ref": "#/$defs/QLCEViewFieldInput"
        },
        "operator": {
          "type": "string",
          "enum": [
            "NOT_IN",
            "IN",
            "EQUALS",
            "NOT_NULL",
            "NULL",
            "LIKE",
            "SEARCH"
          ]
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "QLCEViewFilterWrapper": {
      "type": "object",
      "properties": {
        "idFilter": {
          "$ref": "#/$defs/QLCEViewFilter"
        },
        "timeFilter": {
          "$ref": "#/$defs/QLCEViewTimeFilter"
        },
        "timeRangeTypeFilter": {
          "type": "string",
          "enum": [
            "LAST_MONTH",
            "CURRENT_MONTH"
          ]
        },
        "viewMetadataFilter": {
          "$ref": "#/$defs/QLCEViewMetadataFilter"
        },
        "ruleFilter": {
          "$ref": "#/$defs/QLCEViewRule"
        }
      },
      "description": "Get Recommendations for a perspective"
    },
    "QLCEViewGroupBy": {
      "type": "object",
      "properties": {
        "entityGroupBy": {
          "$ref": "#/$defs/QLCEViewFieldInput"
        },
        "timeTruncGroupBy": {
          "$ref": "#/$defs/QLCEViewTimeTruncGroupBy"
        }
      }
    },
    "QLCEViewMetadataFilter": {
      "type": "object",
      "properties": {
        "viewId": {
          "type": "string"
        },
        "isPreview": {
          "type": "boolean"
        },
        "preview": {
          "type": "boolean"
        }
      }
    },
    "QLCEViewRule": {
      "type": "object",
      "properties": {
        "conditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/QLCEViewFilter"
          }
        }
      }
    },
    "QLCEViewTimeFilter": {
      "type": "object",
      "properties": {
        "field": {
          "$ref": "#/$defs/QLCEViewFieldInput"
        },
        "operator": {
          "type": "string",
          "enum": [
            "AFTER",
            "BEFORE"
          ]
        },
        "value": {
          "type": "number"
        }
      }
    },
    "QLCEViewTimeTruncGroupBy": {
      "type": "object",
      "properties": {
        "resolution": {
          "type": "string",
          "enum": [
            "HOUR",
            "DAY",
            "MONTH",
            "WEEK",
            "QUARTER",
            "YEAR"
          ]
        }
      }
    }
  }
}