{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/advisorppc-com/json-schema/advisorppc-com-insights-live-out-schema.json",
  "title": "InsightsLiveOut",
  "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/InsightsLiveOut",
  "properties": {
    "polled_at": {
      "type": "string",
      "format": "date-time",
      "title": "Polled At"
    },
    "refresh_seconds": {
      "type": "integer",
      "title": "Refresh Seconds",
      "default": 60
    },
    "reporting": {
      "$ref": "#/$defs/InsightsReportingOut"
    },
    "ad_spend": {
      "$ref": "#/$defs/LiveAdSpendOut"
    },
    "traffic": {
      "$ref": "#/$defs/LiveTrafficOut"
    },
    "approvals": {
      "$ref": "#/$defs/LiveApprovalsOut"
    },
    "conversions": {
      "$ref": "#/$defs/LiveConversionsOut"
    }
  },
  "type": "object",
  "required": [
    "polled_at",
    "reporting",
    "ad_spend",
    "traffic",
    "approvals",
    "conversions"
  ],
  "$defs": {
    "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."
    },
    "LiveAdSpendOut": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "detail": {
          "type": "string",
          "title": "Detail",
          "default": ""
        },
        "as_of": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "As Of"
        },
        "through": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Through"
        },
        "cycle_label": {
          "type": "string",
          "title": "Cycle Label",
          "default": ""
        },
        "cycle_spend": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cycle Spend"
        },
        "previous_cycle_spend": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Previous Cycle Spend"
        },
        "delta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delta"
        },
        "trend": {
          "items": {
            "$ref": "#/$defs/SpendPointOut"
          },
          "type": "array",
          "title": "Trend"
        },
        "platforms": {
          "items": {
            "$ref": "#/$defs/LivePlatformSpendOut"
          },
          "type": "array",
          "title": "Platforms"
        }
      },
      "type": "object",
      "required": [
        "state"
      ],
      "title": "LiveAdSpendOut"
    },
    "LiveApprovalItemOut": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "playbook_key": {
          "type": "string",
          "title": "Playbook Key"
        },
        "account_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Account Label"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "title",
        "playbook_key",
        "created_at"
      ],
      "title": "LiveApprovalItemOut"
    },
    "LiveApprovalsOut": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "detail": {
          "type": "string",
          "title": "Detail",
          "default": ""
        },
        "as_of": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "As Of"
        },
        "through": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Through"
        },
        "count": {
          "type": "integer",
          "title": "Count",
          "default": 0
        },
        "items": {
          "items": {
            "$ref": "#/$defs/LiveApprovalItemOut"
          },
          "type": "array",
          "title": "Items"
        },
        "href": {
          "type": "string",
          "title": "Href",
          "default": "/app/optimization"
        }
      },
      "type": "object",
      "required": [
        "state"
      ],
      "title": "LiveApprovalsOut"
    },
    "LiveConversionsOut": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "detail": {
          "type": "string",
          "title": "Detail",
          "default": ""
        },
        "as_of": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "As Of"
        },
        "through": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Through"
        },
        "conversions": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Conversions"
        },
        "revenue": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenue"
        },
        "roas": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Roas"
        },
        "tracks_revenue": {
          "type": "boolean",
          "title": "Tracks Revenue",
          "default": false
        },
        "conversions_delta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Conversions Delta"
        },
        "revenue_delta": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenue Delta"
        }
      },
      "type": "object",
      "required": [
        "state"
      ],
      "title": "LiveConversionsOut"
    },
    "LivePlatformSpendOut": {
      "properties": {
        "platform": {
          "type": "string",
          "title": "Platform"
        },
        "spend": {
          "type": "number",
          "title": "Spend"
        }
      },
      "type": "object",
      "required": [
        "platform",
        "spend"
      ],
      "title": "LivePlatformSpendOut"
    },
    "LiveTrafficOut": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "detail": {
          "type": "string",
          "title": "Detail",
          "default": ""
        },
        "as_of": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "As Of"
        },
        "through": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Through"
        },
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source"
        },
        "unit": {
          "type": "string",
          "title": "Unit",
          "default": "sessions"
        },
        "window_days": {
          "type": "integer",
          "title": "Window Days",
          "default": 7
        },
        "paid": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Paid"
        },
        "organic": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Organic"
        },
        "other": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Other"
        },
        "paid_share": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Paid Share"
        }
      },
      "type": "object",
      "required": [
        "state"
      ],
      "title": "LiveTrafficOut"
    },
    "SpendPointOut": {
      "properties": {
        "date": {
          "type": "string",
          "title": "Date"
        },
        "spend": {
          "type": "number",
          "title": "Spend"
        }
      },
      "type": "object",
      "required": [
        "date",
        "spend"
      ],
      "title": "SpendPointOut"
    }
  }
}