{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frontapp/json-schema/frontapp-analytics-report-response-schema.json",
  "title": "AnalyticsReportResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frontapp-analytics-api-openapi.yml#/components/schemas/AnalyticsReportResponse",
  "type": "object",
  "required": [
    "_links",
    "uid",
    "status",
    "progress",
    "metrics"
  ],
  "properties": {
    "_links": {
      "type": "object",
      "properties": {
        "self": {
          "type": "string",
          "description": "Link to analytics job."
        }
      }
    },
    "uid": {
      "type": "string",
      "description": "The UID of the analytics report"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "done",
        "failed"
      ],
      "description": "Status of the report."
    },
    "progress": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "description": "Number ranging from 0 to 100 corresponding to the percentage of the analytics processed."
    },
    "metrics": {
      "type": "array",
      "description": "The metrics computed for the report.",
      "items": {
        "$ref": "#/$defs/AnalyticsScalar"
      }
    }
  },
  "$defs": {
    "AnalyticsMetricId": {
      "type": "string",
      "enum": [
        "avg_csat_survey_response",
        "avg_first_reaction_time",
        "avg_first_response_time",
        "avg_handle_time",
        "avg_reaction_time",
        "avg_replies_to_resolution",
        "avg_resolution_time",
        "avg_response_time",
        "avg_sla_breach_time",
        "avg_tag_duration",
        "avg_total_reply_time",
        "new_segments_count",
        "num_active_accounts",
        "num_active_segments_full",
        "num_active_teammates",
        "num_archived_segments",
        "num_archived_segments_with_reply",
        "num_assigned_segments",
        "num_csat_survey_response",
        "num_messages_received",
        "num_messages_sent",
        "num_new_tasks",
        "num_non_replies_sent",
        "num_replies_sent",
        "num_segments_with_outbounds",
        "num_segments_with_tag_changes",
        "num_sla_breach",
        "num_tags_added",
        "num_tags_removed",
        "num_touched_segments",
        "pct_csat_survey_satisfaction",
        "pct_messages_with_message_templates",
        "pct_resolved_on_first_reply",
        "pct_tagged_conversations",
        "num_closed_segments",
        "num_open_segments_start",
        "num_open_segments_end",
        "num_resolved_segments",
        "num_unresolved_active_segments",
        "num_workload_segments"
      ]
    },
    "AnalyticsScalar": {
      "type": "object",
      "required": [
        "id",
        "type",
        "value"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/AnalyticsMetricId"
        },
        "type": {
          "$ref": "#/$defs/AnalyticsScalarType"
        },
        "value": {
          "$ref": "#/$defs/AnalyticsScalarValue"
        }
      }
    },
    "AnalyticsScalarType": {
      "type": "string",
      "enum": [
        "number",
        "percentage",
        "string",
        "duration",
        "resource"
      ]
    },
    "AnalyticsScalarValue": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            },
            "resource": {
              "type": "object",
              "required": [
                "id",
                "_links"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "_links": {
                  "type": "object",
                  "properties": {
                    "self": {
                      "type": "string",
                      "description": "Link to a resource."
                    }
                  }
                }
              }
            }
          }
        }
      ],
      "description": "The value of a scalar metric."
    }
  }
}