{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/advisorppc-com/json-schema/advisorppc-com-insights-summary-out-schema.json",
  "title": "InsightsSummaryOut",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/advisorppc-com-insights-api-openapi.yml#/components/schemas/InsightsSummaryOut",
  "properties": {
    "kpis": {
      "items": {
        "$ref": "#/$defs/KpiOut"
      },
      "type": "array",
      "title": "Kpis"
    },
    "spendTrend": {
      "items": {
        "$ref": "#/$defs/SpendPointOut"
      },
      "type": "array",
      "title": "Spendtrend"
    },
    "byPlatform": {
      "items": {
        "$ref": "#/$defs/PlatformRowOut"
      },
      "type": "array",
      "title": "Byplatform"
    },
    "reporting": {
      "anyOf": [
        {
          "$ref": "#/$defs/InsightsReportingOut"
        },
        {
          "type": "null"
        }
      ]
    },
    "benchmark": {
      "anyOf": [
        {
          "$ref": "#/$defs/InsightsBenchmarkOut"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "kpis",
    "spendTrend",
    "byPlatform"
  ],
  "$defs": {
    "InsightsBenchmarkOut": {
      "properties": {
        "basis": {
          "type": "string",
          "title": "Basis"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value"
        },
        "source": {
          "type": "string",
          "title": "Source",
          "default": ""
        },
        "detail": {
          "type": "string",
          "title": "Detail",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "basis"
      ],
      "title": "InsightsBenchmarkOut",
      "description": "The yardstick every platform verdict was measured against."
    },
    "InsightsReportingOut": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "managed_account_count": {
          "type": "integer",
          "title": "Managed Account Count"
        },
        "detail": {
          "type": "string",
          "title": "Detail"
        },
        "connectors_url": {
          "type": "string",
          "title": "Connectors Url"
        },
        "since": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Since"
        },
        "until": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Until"
        },
        "observed_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Observed At"
        },
        "currency": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Currency"
        }
      },
      "type": "object",
      "required": [
        "state",
        "managed_account_count",
        "detail",
        "connectors_url"
      ],
      "title": "InsightsReportingOut",
      "description": "Why the summary is empty or zero — never a substitute for numbers."
    },
    "KpiOut": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "value": {
          "type": "string",
          "title": "Value"
        },
        "delta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delta"
        }
      },
      "type": "object",
      "required": [
        "label",
        "value"
      ],
      "title": "KpiOut"
    },
    "PlatformRowOut": {
      "properties": {
        "platform": {
          "type": "string",
          "title": "Platform"
        },
        "spend": {
          "type": "number",
          "title": "Spend"
        },
        "clicks": {
          "type": "integer",
          "title": "Clicks"
        },
        "impressions": {
          "type": "integer",
          "title": "Impressions"
        },
        "conversions": {
          "type": "number",
          "title": "Conversions"
        },
        "revenue": {
          "type": "number",
          "title": "Revenue",
          "default": 0.0
        },
        "roas": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Roas"
        },
        "cpa": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cpa"
        },
        "ctr": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ctr"
        },
        "convRate": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Convrate"
        },
        "spendShare": {
          "type": "number",
          "title": "Spendshare",
          "default": 0.0
        },
        "spendDelta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Spenddelta"
        },
        "revenueDelta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenuedelta"
        },
        "verdict": {
          "type": "string",
          "title": "Verdict",
          "default": "insufficient_signal"
        },
        "verdictLabel": {
          "type": "string",
          "title": "Verdictlabel",
          "default": "No signal"
        },
        "verdictDetail": {
          "type": "string",
          "title": "Verdictdetail",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "platform",
        "spend",
        "clicks",
        "impressions",
        "conversions"
      ],
      "title": "PlatformRowOut",
      "description": "One platform's 30-day totals, plus the derived metrics Overview ranks on.\n\nEverything here is computed from receipted ``campaign_metric_daily`` rows.\nA derived metric whose denominator is zero is ``None``, never 0 — a\nplatform with no revenue has an unknown ROAS, not a ROAS of zero."
    },
    "SpendPointOut": {
      "properties": {
        "date": {
          "type": "string",
          "title": "Date"
        },
        "spend": {
          "type": "number",
          "title": "Spend"
        }
      },
      "type": "object",
      "required": [
        "date",
        "spend"
      ],
      "title": "SpendPointOut"
    }
  }
}