{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usepostify-com/json-schema/usepostify-com-analytics-schema.json",
  "title": "Analytics",
  "description": "Workspace analytics summary.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usepostify-com-openapi.yml#/components/schemas/Analytics",
  "type": "object",
  "properties": {
    "totals": {
      "type": "object",
      "properties": {
        "posts": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "All posts in the workspace."
        },
        "published": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Posts in `published` state."
        },
        "scheduled": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Posts in `scheduled` state."
        },
        "failed": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Posts in `failed` state."
        },
        "channels": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Connected channels."
        }
      },
      "required": [
        "posts",
        "published",
        "scheduled",
        "failed",
        "channels"
      ],
      "additionalProperties": false,
      "description": "Workspace-wide counts."
    },
    "delivery": {
      "type": "object",
      "properties": {
        "attempts": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Per-channel delivery attempts recorded."
        },
        "success_rate": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            {
              "type": "null"
            }
          ],
          "description": "Of the SETTLED attempts (acked/indexed vs failed/dlq), the fraction that succeeded. In-flight attempts are excluded; null when nothing has settled yet."
        }
      },
      "required": [
        "attempts",
        "success_rate"
      ],
      "additionalProperties": false,
      "description": "Delivery pipeline health."
    },
    "timeline": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AnalyticsTimelinePoint"
      },
      "description": "Publishes per UTC day over the last 14 days."
    },
    "engagement": {
      "type": "object",
      "properties": {
        "impressions": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "likes": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "comments": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "shares": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "clicks": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "impressions",
        "likes",
        "comments",
        "shares",
        "clicks"
      ],
      "additionalProperties": false,
      "description": "Summed platform engagement across synced posts. Zeros when metrics have not synced yet."
    }
  },
  "required": [
    "totals",
    "delivery",
    "timeline",
    "engagement"
  ],
  "additionalProperties": false,
  "$defs": {
    "AnalyticsTimelinePoint": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "description": "UTC calendar day (YYYY-MM-DD)."
        },
        "published": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Posts published that day."
        }
      },
      "required": [
        "date",
        "published"
      ],
      "additionalProperties": false
    }
  }
}