{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-project-usage-response-schema.json",
  "title": "ProjectUsageResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/latitude-so-projects-api-openapi.yml#/components/schemas/ProjectUsageResponse",
  "allOf": [
    {
      "$ref": "#/$defs/UsageProject"
    },
    {
      "type": "object",
      "properties": {
        "period": {
          "type": "object",
          "properties": {
            "start": {
              "type": "string",
              "description": "ISO-8601 start of the current billing period."
            },
            "end": {
              "type": "string",
              "description": "ISO-8601 end of the current billing period, exclusive."
            }
          },
          "required": [
            "start",
            "end"
          ],
          "description": "Billing period the usage figures cover."
        }
      },
      "required": [
        "period"
      ]
    }
  ],
  "$defs": {
    "UsageCategory": {
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "enum": [
            "traces",
            "flaggers",
            "signals",
            "behaviors",
            "annotations",
            "other"
          ],
          "description": "Product area the credits were spent on."
        },
        "credits": {
          "type": "integer",
          "description": "Credits spent in this category during the period."
        }
      },
      "required": [
        "category",
        "credits"
      ]
    },
    "UsageProject": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable project identifier."
        },
        "slug": {
          "type": [
            "string",
            "null"
          ],
          "description": "Project slug. `null` when the project no longer exists."
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Project name. `null` when the project no longer exists."
        },
        "credits": {
          "type": "integer",
          "description": "Credits the project spent during the period."
        },
        "categories": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UsageCategory"
          },
          "description": "The project's credits by product area, largest first."
        }
      },
      "required": [
        "id",
        "slug",
        "name",
        "credits",
        "categories"
      ]
    }
  }
}