{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/post-quest-com/json-schema/post-quest-com-analytics-summary-schema.json",
  "title": "AnalyticsSummary",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/post-quest-com-openapi.yaml#/components/schemas/AnalyticsSummary",
  "type": "object",
  "required": [
    "range",
    "period",
    "timezone",
    "history_days",
    "last_synced_at",
    "totals",
    "daily",
    "content_performance",
    "top_posts"
  ],
  "properties": {
    "range": {
      "$ref": "#/$defs/AnalyticsRange"
    },
    "period": {
      "type": "object",
      "required": [
        "start",
        "end"
      ],
      "properties": {
        "start": {
          "type": "string",
          "format": "date"
        },
        "end": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "timezone": {
      "type": "string"
    },
    "history_days": {
      "type": "integer",
      "minimum": 1
    },
    "last_synced_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "totals": {
      "type": "object",
      "required": [
        "impressions",
        "reach",
        "views",
        "engagements",
        "likes",
        "comments",
        "shares",
        "follows"
      ],
      "properties": {
        "impressions": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "reach": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "views": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "engagements": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "likes": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "comments": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "shares": {
          "$ref": "#/$defs/AnalyticsTotal"
        },
        "follows": {
          "$ref": "#/$defs/AnalyticsTotal"
        }
      }
    },
    "daily": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "date",
          "views",
          "reach",
          "likes",
          "engagements",
          "follows"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "views": {
            "type": "integer",
            "minimum": 0
          },
          "reach": {
            "type": "integer",
            "minimum": 0
          },
          "likes": {
            "type": "integer",
            "minimum": 0
          },
          "engagements": {
            "type": "integer",
            "minimum": 0
          },
          "follows": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "content_performance": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "format",
          "posts",
          "engagements",
          "average_engagements"
        ],
        "properties": {
          "format": {
            "$ref": "#/$defs/ContentFormat"
          },
          "posts": {
            "type": "integer",
            "minimum": 0
          },
          "engagements": {
            "type": "integer",
            "minimum": 0
          },
          "average_engagements": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "top_posts": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "object",
        "required": [
          "id",
          "social_account_id",
          "platform",
          "caption",
          "platform_url",
          "content_format",
          "posted_at",
          "engagements"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "social_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform": {
            "$ref": "#/$defs/Platform"
          },
          "caption": {
            "type": "string"
          },
          "platform_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "content_format": {
            "$ref": "#/$defs/ContentFormat"
          },
          "posted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "engagements": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    }
  },
  "$defs": {
    "AnalyticsRange": {
      "type": "string",
      "enum": [
        "7d",
        "14d",
        "30d",
        "90d",
        "6mo",
        "9mo",
        "12mo",
        "24mo",
        "this_month",
        "last_month",
        "this_year",
        "last_year"
      ]
    },
    "AnalyticsTotal": {
      "type": "object",
      "required": [
        "value",
        "previous"
      ],
      "properties": {
        "value": {
          "type": "integer",
          "minimum": 0
        },
        "previous": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "ContentFormat": {
      "type": "string",
      "enum": [
        "video",
        "text",
        "image",
        "carousel",
        "reel",
        "story"
      ]
    },
    "Platform": {
      "type": "string",
      "enum": [
        "instagram",
        "facebook",
        "x",
        "youtube",
        "tiktok",
        "pinterest",
        "linkedin",
        "threads",
        "bluesky",
        "mastodon"
      ]
    }
  }
}