{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://torneo.ai/schemas/scheduler_reservation.v1",
  "title": "scheduler_reservation.v1",
  "description": "RAM, CPU, disk and quota held by one claim, as written to the scheduler ledger (event claim). The reservation lasts from the claim until the attempt finishes or the lease expires; the sum of live reservations never exceeds $defs.capacity (verify_ledger).",
  "type": "object",
  "required": [
    "event",
    "t",
    "job",
    "gen",
    "n",
    "holder",
    "provider",
    "ram",
    "cpu",
    "disk",
    "quota",
    "charged",
    "expires"
  ],
  "additionalProperties": false,
  "properties": {
    "event": {
      "const": "claim"
    },
    "t": {
      "type": "number"
    },
    "job": {
      "type": "string",
      "minLength": 1
    },
    "gen": {
      "type": "integer",
      "minimum": 1
    },
    "n": {
      "type": "integer",
      "minimum": 0
    },
    "holder": {
      "type": "string",
      "minLength": 1
    },
    "provider": {
      "type": "string",
      "minLength": 1
    },
    "ram": {
      "type": "number",
      "minimum": 0
    },
    "cpu": {
      "type": "number",
      "minimum": 0
    },
    "disk": {
      "type": "number",
      "minimum": 0
    },
    "quota": {
      "type": "number",
      "minimum": 0
    },
    "charged": {
      "type": "boolean",
      "description": "False when the quota of this attempt number was already charged."
    },
    "expires": {
      "type": "number"
    }
  },
  "$defs": {
    "capacity": {
      "type": "object",
      "required": [
        "ram_gb",
        "cpu",
        "disk_gb",
        "max_concurrent"
      ],
      "additionalProperties": false,
      "properties": {
        "ram_gb": {
          "type": "number",
          "minimum": 0
        },
        "cpu": {
          "type": "number",
          "minimum": 0
        },
        "disk_gb": {
          "type": "number",
          "minimum": 0
        },
        "max_concurrent": {
          "type": "integer",
          "minimum": 1
        }
      }
    }
  }
}
