{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/everyn-ai/json-schema/everyn-ai-workspace-usage-response-schema.json",
  "title": "WorkspaceUsageResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/everyn-ai-usage-api-openapi.yml#/components/schemas/WorkspaceUsageResponse",
  "additionalProperties": false,
  "properties": {
    "availability": {
      "const": "available",
      "title": "Availability",
      "type": "string"
    },
    "billingAccountId": {
      "title": "Billingaccountid",
      "type": "string"
    },
    "calculatedAt": {
      "format": "date-time",
      "title": "Calculatedat",
      "type": "string"
    },
    "includedRows": {
      "$ref": "#/$defs/WorkspaceIncludedRowsResponse"
    },
    "managedAi": {
      "$ref": "#/$defs/WorkspaceManagedAiResponse"
    },
    "organizationId": {
      "title": "Organizationid",
      "type": "string"
    },
    "payg": {
      "$ref": "#/$defs/WorkspacePaygResponse"
    },
    "period": {
      "$ref": "#/$defs/WorkspaceUsagePeriodResponse"
    },
    "primaryConsequence": {
      "enum": [
        "subscription_hard_stop",
        "financial_hold",
        "row_risk_hold",
        "managed_ai_unavailable",
        "rows_unavailable",
        "usage_low",
        "available"
      ],
      "title": "Primaryconsequence",
      "type": "string"
    }
  },
  "required": [
    "availability",
    "organizationId",
    "billingAccountId",
    "calculatedAt",
    "period",
    "includedRows",
    "payg",
    "managedAi",
    "primaryConsequence"
  ],
  "type": "object",
  "$defs": {
    "CustomerMoneyResponse": {
      "additionalProperties": false,
      "properties": {
        "amount": {
          "description": "Exact base-10 amount serialized without binary floating point or exponent notation.",
          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
          "title": "Amount",
          "type": "string"
        },
        "currencyCode": {
          "maxLength": 3,
          "minLength": 3,
          "title": "Currencycode",
          "type": "string"
        }
      },
      "required": [
        "currencyCode",
        "amount"
      ],
      "title": "CustomerMoneyResponse",
      "type": "object"
    },
    "WorkspaceIncludedRowsResponse": {
      "additionalProperties": false,
      "properties": {
        "remaining": {
          "minimum": 0.0,
          "title": "Remaining",
          "type": "integer"
        },
        "status": {
          "enum": [
            "available",
            "low",
            "exhausted"
          ],
          "title": "Status",
          "type": "string"
        },
        "total": {
          "minimum": 0.0,
          "title": "Total",
          "type": "integer"
        },
        "used": {
          "minimum": 0.0,
          "title": "Used",
          "type": "integer"
        }
      },
      "required": [
        "used",
        "total",
        "remaining",
        "status"
      ],
      "title": "WorkspaceIncludedRowsResponse",
      "type": "object"
    },
    "WorkspaceManagedAiExpirationResponse": {
      "additionalProperties": false,
      "properties": {
        "amount": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "expiresAt": {
          "format": "date-time",
          "title": "Expiresat",
          "type": "string"
        }
      },
      "required": [
        "expiresAt",
        "amount"
      ],
      "title": "WorkspaceManagedAiExpirationResponse",
      "type": "object"
    },
    "WorkspaceManagedAiResponse": {
      "additionalProperties": false,
      "properties": {
        "executionSafe": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "nextExpiration": {
          "anyOf": [
            {
              "$ref": "#/$defs/WorkspaceManagedAiExpirationResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "settledBalance": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/WorkspaceManagedAiSourceResponse"
          },
          "title": "Sources",
          "type": "array"
        },
        "status": {
          "enum": [
            "available",
            "low",
            "unavailable"
          ],
          "title": "Status",
          "type": "string"
        }
      },
      "required": [
        "executionSafe",
        "settledBalance",
        "status",
        "sources",
        "nextExpiration"
      ],
      "title": "WorkspaceManagedAiResponse",
      "type": "object"
    },
    "WorkspaceManagedAiSourceResponse": {
      "additionalProperties": false,
      "properties": {
        "available": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "kind": {
          "enum": [
            "cardless_sample",
            "promotional",
            "recurring",
            "purchased",
            "correction"
          ],
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "available"
      ],
      "title": "WorkspaceManagedAiSourceResponse",
      "type": "object"
    },
    "WorkspacePaygResponse": {
      "additionalProperties": false,
      "properties": {
        "acceptedBudget": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "committedBudget": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "enabled": {
          "title": "Enabled",
          "type": "boolean"
        },
        "ratedRows": {
          "minimum": 0.0,
          "title": "Ratedrows",
          "type": "integer"
        },
        "remainingBudget": {
          "$ref": "#/$defs/CustomerMoneyResponse"
        },
        "status": {
          "enum": [
            "off",
            "available",
            "low",
            "exhausted"
          ],
          "title": "Status",
          "type": "string"
        }
      },
      "required": [
        "enabled",
        "ratedRows",
        "acceptedBudget",
        "committedBudget",
        "remainingBudget",
        "status"
      ],
      "title": "WorkspacePaygResponse",
      "type": "object"
    },
    "WorkspaceUsagePeriodResponse": {
      "additionalProperties": false,
      "properties": {
        "end": {
          "format": "date-time",
          "title": "End",
          "type": "string"
        },
        "id": {
          "title": "Id",
          "type": "string"
        },
        "start": {
          "format": "date-time",
          "title": "Start",
          "type": "string"
        }
      },
      "required": [
        "id",
        "start",
        "end"
      ],
      "title": "WorkspaceUsagePeriodResponse",
      "type": "object"
    }
  }
}