{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://api.reputation.com/v3/schemas/metric",
  "title": "Metric",
  "description": "Reputation performance metric data for a location or group of locations.",
  "type": "object",
  "properties": {
    "locationID": {
      "type": "string",
      "description": "ID of the location (or aggregate if not set)"
    },
    "range": {
      "type": "object",
      "description": "Date range for the metric data",
      "properties": {
        "from": {"type": "string", "format": "date-time"},
        "to": {"type": "string", "format": "date-time"},
        "preset": {"type": "string"}
      }
    },
    "reputationScore": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000,
      "description": "Overall Reputation Score (0-1000)"
    },
    "averageRating": {
      "type": "number",
      "minimum": 0,
      "maximum": 5,
      "description": "Average star rating across all sources"
    },
    "reviewCount": {
      "type": "integer",
      "description": "Total number of reviews in the period"
    },
    "responseRate": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage of reviews with owner responses"
    },
    "listingAccuracy": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage accuracy of business listings across sources"
    },
    "sentimentBreakdown": {
      "type": "object",
      "properties": {
        "positive": {"type": "integer"},
        "neutral": {"type": "integer"},
        "negative": {"type": "integer"}
      }
    },
    "sourceBreakdown": {
      "type": "array",
      "description": "Metrics broken down by review source",
      "items": {
        "type": "object",
        "properties": {
          "sourceID": {"type": "string"},
          "sourceName": {"type": "string"},
          "reviewCount": {"type": "integer"},
          "averageRating": {"type": "number"}
        }
      }
    }
  }
}
