{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cognition-labs/json-schema/cognition-labs-enterprise-consumption-response-schema.json",
  "title": "EnterpriseConsumptionResponse",
  "description": "Enterprise consumption data response",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cognition-labs-enterprise-api-openapi.yml#/components/schemas/EnterpriseConsumptionResponse",
  "type": "object",
  "properties": {
    "sessions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ConsumptionSession"
      },
      "description": "List of sessions with consumption data"
    },
    "cycle": {
      "$ref": "#/$defs/ConsumptionCycle",
      "description": "Billing cycle information"
    }
  },
  "required": [
    "sessions",
    "cycle"
  ],
  "$defs": {
    "ConsumptionCycle": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "format": "date",
          "description": "Start date of the billing cycle"
        },
        "end": {
          "type": "string",
          "format": "date",
          "description": "End date of the billing cycle"
        }
      },
      "required": [
        "start",
        "end"
      ],
      "description": "Billing cycle information"
    },
    "ConsumptionPullRequest": {
      "type": "object",
      "properties": {
        "pr_url": {
          "type": "string",
          "format": "uri",
          "description": "URL of the pull request"
        },
        "pr_status": {
          "type": "string",
          "description": "Status of the pull request",
          "enum": [
            "open",
            "closed",
            "merged"
          ]
        }
      },
      "required": [
        "pr_url",
        "pr_status"
      ],
      "description": "Pull request information"
    },
    "ConsumptionSession": {
      "type": "object",
      "properties": {
        "user_name": {
          "type": "string",
          "description": "Name of the user who created the session"
        },
        "user_email": {
          "type": "string",
          "format": "email",
          "description": "Email address of the user"
        },
        "session_name": {
          "type": "string",
          "description": "Name/title of the session"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Session creation timestamp in ISO format"
        },
        "acu_used": {
          "type": "number",
          "format": "float",
          "description": "Amount of ACUs (Agent Compute Units) consumed"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL to view the session"
        },
        "org_id": {
          "type": "string",
          "description": "Organization identifier"
        },
        "org_name": {
          "type": "string",
          "description": "Organization name"
        },
        "pull_requests": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConsumptionPullRequest"
          },
          "description": "List of pull requests created during the session"
        }
      },
      "required": [
        "user_name",
        "user_email",
        "session_name",
        "created_at",
        "acu_used",
        "url",
        "org_id",
        "org_name",
        "pull_requests"
      ],
      "description": "Session consumption data"
    }
  }
}