{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-outcomes-response-schema.json",
  "title": "OutcomesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onclarity-com-agent-usage-api-openapi.yml#/components/schemas/OutcomesResponse",
  "properties": {
    "range": {
      "$ref": "#/$defs/src__agent_usage__schemas__DateRange"
    },
    "previous_range": {
      "anyOf": [
        {
          "$ref": "#/$defs/src__agent_usage__schemas__DateRange"
        },
        {
          "type": "null"
        }
      ]
    },
    "previous": {
      "anyOf": [
        {
          "$ref": "#/$defs/OutcomeCounts"
        },
        {
          "type": "null"
        }
      ]
    },
    "reports_created": {
      "type": "integer",
      "title": "Reports Created",
      "default": 0
    },
    "mini_apps_published": {
      "type": "integer",
      "title": "Mini Apps Published",
      "default": 0
    },
    "dashboard_pins": {
      "type": "integer",
      "title": "Dashboard Pins",
      "default": 0
    },
    "conversation_shares": {
      "type": "integer",
      "title": "Conversation Shares",
      "default": 0
    },
    "artifact_links": {
      "type": "integer",
      "title": "Artifact Links",
      "default": 0
    },
    "shares_created": {
      "type": "integer",
      "title": "Shares Created",
      "default": 0
    },
    "files_produced": {
      "type": "integer",
      "title": "Files Produced",
      "default": 0
    },
    "routines": {
      "items": {
        "$ref": "#/$defs/RoutineOutcomeRow"
      },
      "type": "array",
      "title": "Routines",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "range"
  ],
  "$defs": {
    "OutcomeCounts": {
      "properties": {
        "reports_created": {
          "type": "integer",
          "title": "Reports Created",
          "default": 0
        },
        "mini_apps_published": {
          "type": "integer",
          "title": "Mini Apps Published",
          "default": 0
        },
        "dashboard_pins": {
          "type": "integer",
          "title": "Dashboard Pins",
          "default": 0
        },
        "conversation_shares": {
          "type": "integer",
          "title": "Conversation Shares",
          "default": 0
        },
        "artifact_links": {
          "type": "integer",
          "title": "Artifact Links",
          "default": 0
        },
        "shares_created": {
          "type": "integer",
          "title": "Shares Created",
          "default": 0
        },
        "files_produced": {
          "type": "integer",
          "title": "Files Produced",
          "default": 0
        }
      },
      "type": "object",
      "title": "OutcomeCounts",
      "description": "The scalar outcome counts for one window — used for the prior-period comparison."
    },
    "RoutineOutcomeRow": {
      "properties": {
        "routine_id": {
          "type": "integer",
          "title": "Routine Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "runs": {
          "type": "integer",
          "title": "Runs",
          "default": 0
        },
        "succeeded": {
          "type": "integer",
          "title": "Succeeded",
          "default": 0
        },
        "failed": {
          "type": "integer",
          "title": "Failed",
          "default": 0
        },
        "needs_input": {
          "type": "integer",
          "title": "Needs Input",
          "default": 0
        },
        "last_run_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Run At"
        }
      },
      "type": "object",
      "required": [
        "routine_id",
        "name"
      ],
      "title": "RoutineOutcomeRow"
    },
    "src__agent_usage__schemas__DateRange": {
      "properties": {
        "from": {
          "type": "string",
          "format": "date",
          "title": "From"
        },
        "to": {
          "type": "string",
          "format": "date",
          "title": "To"
        }
      },
      "type": "object",
      "required": [
        "from",
        "to"
      ],
      "title": "DateRange",
      "description": "Effective (post-clamp) INCLUSIVE date range a response covers."
    }
  }
}