{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mandala-computer/json-schema/mandala-computer-account-quota-schema.json",
  "title": "AccountQuota",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mandala-computer-openapi.json#/components/schemas/AccountQuota",
  "type": "object",
  "properties": {
    "scope": {
      "type": "string",
      "const": "account",
      "description": "Whole-account aggregates, including for workspace-scoped viewers."
    },
    "advisory": {
      "type": "boolean",
      "const": true,
      "description": "An observation, never an admission guarantee or reservation. Admission — of a create or clone, a start, restart, restore or resume, a resize, a move, a never-suspend pin or a template build — also counts two things left out here: a create or clone that reached a host whose answer was lost, or was a `5xx` that cannot rule out a computer was built (see `POST /computers`), and a reservation of running vCPU and RAM for each seed one of your own templates boots for fast launches. The seed has 30 seconds to start, but its reservation stays charged until the platform confirms both that the seed is gone and that its permission to start has run out. While its host cannot be asked — unreachable, halted, removed or registered again — it stays charged. Either can make a `402` name more than these numbers show."
    },
    "observed_at": {
      "type": "string",
      "format": "date-time",
      "description": "UTC collection completion time; not a consistency token."
    },
    "plan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Effective plan catalogue identifier."
        },
        "label": {
          "type": "string",
          "description": "Effective plan label."
        }
      },
      "required": [
        "id",
        "label"
      ],
      "additionalProperties": false
    },
    "limits": {
      "type": "object",
      "properties": {
        "max_computers": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Maximum kept computers; existing starts also check active or reserved count."
        },
        "vcpu_pool": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Account vCPU pool ceiling."
        },
        "ram_pool_mb": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Running or reserved guest RAM ceiling, MB."
        },
        "disk_pool_gb": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Configured disk pool ceiling, GB. Shared by computers’ configured disks and the template builds the account keeps."
        },
        "snapshot_storage_bytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Snapshot storage ceiling, exact bytes (plan GB multiplied by 1024 cubed)."
        }
      },
      "required": [
        "max_computers",
        "vcpu_pool",
        "ram_pool_mb",
        "disk_pool_gb",
        "snapshot_storage_bytes"
      ],
      "additionalProperties": false
    },
    "per_computer": {
      "type": "object",
      "properties": {
        "max_vcpu": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Per-computer vCPU maximum."
        },
        "max_ram_mb": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Per-computer RAM maximum, MB."
        },
        "max_disk_gb": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Per-computer disk maximum, GB."
        }
      },
      "required": [
        "max_vcpu",
        "max_ram_mb",
        "max_disk_gb"
      ],
      "additionalProperties": false
    },
    "capabilities": {
      "type": "object",
      "properties": {
        "windows": {
          "type": "boolean",
          "description": "Whether the plan permits Windows computers."
        },
        "macos": {
          "type": "boolean",
          "description": "Whether this account may launch macOS computers. Granted per account on request, never by a plan."
        }
      },
      "required": [
        "windows",
        "macos"
      ],
      "additionalProperties": false
    },
    "complete": {
      "type": "object",
      "properties": {
        "computers": {
          "type": "boolean",
          "description": "Every relevant computer inventory answered with valid numbers."
        },
        "snapshots": {
          "type": "boolean",
          "description": "Every relevant snapshot inventory answered with valid indexed byte sizes."
        }
      },
      "required": [
        "computers",
        "snapshots"
      ],
      "additionalProperties": false
    },
    "usage": {
      "type": "object",
      "properties": {
        "kept_computers": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "All kept computers, including stopped, suspended, building and deletion states still in inventory. Null when computers are incomplete."
        },
        "configured_vcpu": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Sum of configured vCPU over all kept computers, regardless of power state. Null when computers are incomplete."
        },
        "configured_disk_gb": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Sum of configured disk GB; not filesystem occupancy. Null when computers are incomplete."
        },
        "running_or_reserved_computers": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Computers with positive running or reserved RAM, including pending starts. Null when computers are incomplete."
        },
        "running_or_reserved_vcpu": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Configured vCPU of computers with positive running or reserved RAM; starts check this separately from configured vCPU. Null when computers are incomplete."
        },
        "running_or_reserved_ram_mb": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Guest RAM in use or reserved for a pending start, MB. Explicit zero overrides power state; legacy unknown state conservatively counts configured RAM. Null when computers are incomplete."
        },
        "snapshot_storage_bytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Indexed stored bytes, including pending/deleting snapshots. A snapshot held by two hosts during a handover counts once. Capture placeholders contribute explicit zero indexed bytes; private in-flight capture reservations are not exposed. Null when snapshots are incomplete."
        }
      },
      "required": [
        "kept_computers",
        "configured_vcpu",
        "configured_disk_gb",
        "running_or_reserved_computers",
        "running_or_reserved_vcpu",
        "running_or_reserved_ram_mb",
        "snapshot_storage_bytes"
      ],
      "additionalProperties": false
    },
    "remaining": {
      "type": "object",
      "properties": {
        "kept_computers": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Maximum minus kept count, clamped at zero. Null when computers are incomplete."
        },
        "configured_vcpu": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "vCPU ceiling minus configured vCPU, clamped at zero. Not a start allowance after downgrade. Null when computers are incomplete."
        },
        "configured_disk_gb": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Disk ceiling minus configured disk, GB, clamped at zero. Kept template builds share the pool and are not subtracted here, so a create or resize can still be refused for storage. Null when computers are incomplete."
        },
        "running_or_reserved_ram_mb": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "RAM ceiling minus running or reserved RAM, MB, clamped at zero. Null when computers are incomplete."
        },
        "snapshot_storage_bytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Headroom against indexed stored bytes, clamped at zero; not an available capture reservation. Null when snapshots are incomplete."
        }
      },
      "required": [
        "kept_computers",
        "configured_vcpu",
        "configured_disk_gb",
        "running_or_reserved_ram_mb",
        "snapshot_storage_bytes"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "scope",
    "advisory",
    "observed_at",
    "plan",
    "limits",
    "per_computer",
    "capabilities",
    "complete",
    "usage",
    "remaining"
  ],
  "additionalProperties": false
}