{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-analytics-schema-schema.json",
  "title": "AnalyticsSchema",
  "description": "What can be queried in this project: metrics (by slug), measure types, filters, breakdowns.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-analytics-api-openapi.yml#/components/schemas/AnalyticsSchema",
  "type": "object",
  "properties": {
    "metrics": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "outputType": {
            "type": "string"
          },
          "isThreshold": {
            "type": "boolean"
          },
          "defaultAggregation": {
            "type": "string",
            "enum": [
              "COUNT",
              "AVG",
              "MIN",
              "MAX",
              "SUM",
              "MEDIAN",
              "PERCENTILE",
              "PASS_RATE"
            ]
          },
          "aggregations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "COUNT",
                "AVG",
                "MIN",
                "MAX",
                "SUM",
                "MEDIAN",
                "PERCENTILE",
                "PASS_RATE"
              ]
            }
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "outputType",
          "isThreshold",
          "defaultAggregation",
          "aggregations"
        ]
      }
    },
    "measureTypes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "METRIC",
              "CONVERSATION",
              "UPTIME"
            ]
          },
          "description": {
            "type": "string"
          },
          "aggregations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "COUNT",
                "AVG",
                "MIN",
                "MAX",
                "SUM",
                "MEDIAN",
                "PERCENTILE",
                "PASS_RATE"
              ]
            }
          }
        },
        "required": [
          "type",
          "description",
          "aggregations"
        ]
      }
    },
    "filters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "METRIC_PROPERTY",
              "CALL_PROPERTY",
              "AGENT_PROPERTY",
              "CALL_ID",
              "MODALITY",
              "DATASET",
              "METRIC_VALUE"
            ]
          },
          "description": {
            "type": "string"
          },
          "properties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "property": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "property",
                "description"
              ]
            }
          }
        },
        "required": [
          "type",
          "description",
          "properties"
        ]
      }
    },
    "breakdowns": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "METRIC_PROPERTY",
              "CALL_PROPERTY",
              "AGENT_PROPERTY",
              "DATASET"
            ]
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "description"
        ]
      }
    },
    "callProperties": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "valueType": {
            "type": "string"
          },
          "isSystem": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "valueType",
          "isSystem"
        ]
      }
    },
    "operators": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "EQUALS",
          "NOT_EQUALS",
          "GREATER_THAN",
          "GREATER_THAN_OR_EQUAL_TO",
          "LESS_THAN",
          "LESS_THAN_OR_EQUAL_TO",
          "CONTAINS",
          "STARTS_WITH",
          "IS_SET",
          "IS_NOT_SET"
        ]
      }
    },
    "intervals": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "HOUR",
          "DAY",
          "WEEK",
          "MONTH"
        ]
      }
    },
    "displayTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "LINE",
          "NUMBER",
          "RADAR",
          "STACKED_BAR",
          "TABLE"
        ]
      }
    }
  },
  "required": [
    "metrics",
    "measureTypes",
    "filters",
    "breakdowns",
    "callProperties",
    "operators",
    "intervals",
    "displayTypes"
  ]
}