{
  "$defs": {
    "FallbackEntry": {
      "additionalProperties": false,
      "description": "\u00a719 fallback note. ``effect`` says how the interval changed, in plain words.",
      "properties": {
        "acknowledged_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Acknowledged At"
        },
        "acknowledged_by": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Acknowledged By"
        },
        "assumed": {
          "title": "Assumed",
          "type": "string"
        },
        "code": {
          "pattern": "^[A-Z][A-Z0-9_]*$",
          "title": "Code",
          "type": "string"
        },
        "effect": {
          "title": "Effect",
          "type": "string"
        },
        "envelope_kind": {
          "anyOf": [
            {
              "enum": [
                "bound",
                "range"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "G-DEP-01 (spec \u00a77): `bound` for sums, means, CVaR and monotone functions of sums; `range` for quantile-type, non-monotone outputs and EVOI. A range is never a bound.",
          "title": "Envelope Kind"
        },
        "field": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Field"
        },
        "gate": {
          "title": "Gate",
          "type": "string"
        },
        "interval_after": {
          "anyOf": [
            {
              "$ref": "#/$defs/Interval"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "interval_before": {
          "anyOf": [
            {
              "$ref": "#/$defs/Interval"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "code",
        "gate",
        "assumed",
        "effect"
      ],
      "title": "FallbackEntry",
      "type": "object"
    },
    "Interval": {
      "additionalProperties": false,
      "properties": {
        "hi": {
          "title": "Hi",
          "type": "number"
        },
        "level": {
          "default": 0.9,
          "exclusiveMaximum": 1,
          "exclusiveMinimum": 0,
          "title": "Level",
          "type": "number"
        },
        "lo": {
          "title": "Lo",
          "type": "number"
        },
        "method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Method"
        },
        "segments": {
          "anyOf": [
            {
              "items": {
                "maxItems": 2,
                "minItems": 2,
                "prefixItems": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  }
                ],
                "type": "array"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Spec \u00a75: an `hdi` region that is not one interval, as ordered, non-overlapping [lo, hi] segments inside [lo, hi] (note MULTIMODAL_HDI).",
          "title": "Segments"
        }
      },
      "required": [
        "lo",
        "hi"
      ],
      "title": "Interval",
      "type": "object"
    },
    "JobStep": {
      "additionalProperties": false,
      "properties": {
        "data": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional structured progress for UIs (e2e runner: key, title, plain_summary, status, facts, links, ids, technical_log).",
          "title": "Data"
        },
        "detail": {
          "default": "",
          "title": "Detail",
          "type": "string"
        },
        "ended_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ended At"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "started_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Started At"
        },
        "status": {
          "default": "pending",
          "enum": [
            "pending",
            "running",
            "succeeded",
            "failed",
            "skipped"
          ],
          "title": "Status",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "title": "JobStep",
      "type": "object"
    },
    "Problem": {
      "additionalProperties": false,
      "description": "RFC 9457 problem details plus the UMP extension members of spec \u00a719: stable ``code``, ``gate_id``,\n``pointer``, ``suggested_action``, ``errors`` (every problem when several are returned) and\n``untrusted_text`` kept apart from platform text. ``type`` is always the code's registered URI.\nServed as ``application/problem+json``.",
      "properties": {
        "code": {
          "pattern": "^[A-Z][A-Z0-9_]*$",
          "title": "Code",
          "type": "string"
        },
        "detail": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Detail"
        },
        "errors": {
          "items": {
            "$ref": "#/$defs/ProblemIssue"
          },
          "title": "Errors",
          "type": "array"
        },
        "extra": {
          "additionalProperties": true,
          "title": "Extra",
          "type": "object"
        },
        "fallbacks": {
          "items": {
            "$ref": "#/$defs/FallbackEntry"
          },
          "title": "Fallbacks",
          "type": "array"
        },
        "gate_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Gate Id"
        },
        "instance": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Instance"
        },
        "pointer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Pointer"
        },
        "status": {
          "title": "Status",
          "type": "integer"
        },
        "suggested_action": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Suggested Action"
        },
        "title": {
          "title": "Title",
          "type": "string"
        },
        "type": {
          "default": "",
          "description": "Always the registered URI of ``code`` (set on validation).",
          "title": "Type",
          "type": "string"
        },
        "untrusted_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Untrusted Text"
        }
      },
      "required": [
        "title",
        "status",
        "code"
      ],
      "title": "Problem",
      "type": "object"
    },
    "ProblemIssue": {
      "additionalProperties": false,
      "description": "One entry of a problem's ``errors`` member (spec \u00a719): ``{code, gate_id, pointer, detail}``.",
      "properties": {
        "code": {
          "pattern": "^[A-Z][A-Z0-9_]*$",
          "title": "Code",
          "type": "string"
        },
        "detail": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Detail"
        },
        "gate_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The gate that raised this problem, when a gate did.",
          "title": "Gate Id"
        },
        "pointer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Pointer"
        }
      },
      "required": [
        "code"
      ],
      "title": "ProblemIssue",
      "type": "object"
    }
  },
  "$id": "https://schemas.ump.dev/v1/job.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Spec \u00a719 job: ``state``, ``steps`` and, once terminal, ``result`` or ``problem`` (RFC 9457).",
  "properties": {
    "client_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The client the job works on, when it has one. A job with no client is visible only to its submitter, services and ops roles.",
      "title": "Client Id"
    },
    "created_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Created At"
    },
    "id": {
      "title": "Id",
      "type": "string"
    },
    "kind": {
      "title": "Kind",
      "type": "string"
    },
    "params": {
      "additionalProperties": true,
      "title": "Params",
      "type": "object"
    },
    "principal": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Who submitted the job. Job routes show and cancel it only for this principal, a service, an ops role or a caller scoped to client_id.",
      "title": "Principal"
    },
    "problem": {
      "anyOf": [
        {
          "$ref": "#/$defs/Problem"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "progress": {
      "default": 0.0,
      "maximum": 1,
      "minimum": 0,
      "title": "Progress",
      "type": "number"
    },
    "result": {
      "default": null,
      "title": "Result"
    },
    "state": {
      "default": "queued",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelled"
      ],
      "title": "State",
      "type": "string"
    },
    "steps": {
      "items": {
        "$ref": "#/$defs/JobStep"
      },
      "title": "Steps",
      "type": "array"
    },
    "updated_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Updated At"
    }
  },
  "required": [
    "id",
    "kind"
  ],
  "title": "Job",
  "type": "object"
}
