{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://torneo.ai/schemas/scheduler_lease.v1",
  "title": "scheduler_lease.v1",
  "description": "Lease handed to a holder by Scheduler.claim (torneo_platform.scheduler.Claim as a mapping). The generation fences every later write.",
  "type": "object",
  "required": [
    "job_id",
    "gen",
    "n",
    "holder",
    "op",
    "provider",
    "draw_key",
    "args",
    "expires"
  ],
  "additionalProperties": false,
  "properties": {
    "job_id": {
      "type": "string",
      "minLength": 1
    },
    "gen": {
      "type": "integer",
      "minimum": 1,
      "description": "Lease generation, strictly increasing per job: a write by an older generation is refused (StaleLease)."
    },
    "n": {
      "type": "integer",
      "minimum": 0,
      "description": "Attempt number under this lease."
    },
    "holder": {
      "type": "string",
      "minLength": 1
    },
    "op": {
      "type": "string",
      "minLength": 1
    },
    "provider": {
      "type": "string",
      "minLength": 1
    },
    "draw_key": {
      "type": "string",
      "minLength": 1
    },
    "args": {
      "type": "object"
    },
    "expires": {
      "type": "number",
      "description": "Scheduler clock instant at which the lease lapses unless a heartbeat extends it."
    }
  }
}
