{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1,
      "description": "schema version recorded for this result."
    },
    "id": {
      "type": "string",
      "description": "Resource identifier returned by the operation."
    },
    "workspace_id": {
      "type": "string",
      "description": "Workspace that owns this record."
    },
    "project_id": {
      "type": "string",
      "description": "Project that owns this record."
    },
    "run_id": {
      "type": "string",
      "description": "run id recorded for this result."
    },
    "state": {
      "type": "string",
      "enum": [
        "pending",
        "completed",
        "partial",
        "failed"
      ],
      "description": "Saved lifecycle or evidence state, as enumerated for this record."
    },
    "counts": {
      "type": "object",
      "properties": {
        "rejected": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "rejected recorded for this result."
        },
        "queued": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "queued recorded for this result."
        },
        "running": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "running recorded for this result."
        },
        "succeeded": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "succeeded recorded for this result."
        },
        "failed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "failed recorded for this result."
        },
        "cancelled": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "cancelled recorded for this result."
        }
      },
      "required": [
        "rejected",
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelled"
      ],
      "additionalProperties": false,
      "description": "counts recorded for this result."
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "ordinal recorded for this result."
          },
          "candidate_id": {
            "type": "string",
            "description": "candidate id recorded for this result."
          },
          "local_reference": {
            "anyOf": [
              {
                "type": "string",
                "description": "Customer reference for joining this record to a local ledger entry."
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer reference for joining this record to a local ledger entry."
          },
          "job_id": {
            "anyOf": [
              {
                "type": "string",
                "description": "job id recorded for this result."
              },
              {
                "type": "null"
              }
            ],
            "description": "job id recorded for this result."
          },
          "watch_id": {
            "anyOf": [
              {
                "type": "string",
                "description": "watch id recorded for this result."
              },
              {
                "type": "null"
              }
            ],
            "description": "watch id recorded for this result."
          },
          "state": {
            "type": "string",
            "enum": [
              "rejected",
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ],
            "description": "Saved lifecycle or evidence state, as enumerated for this record."
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string",
                "description": "error code recorded for this result."
              },
              {
                "type": "null"
              }
            ],
            "description": "error code recorded for this result."
          },
          "observation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Resource identifier returned by the operation."
                  },
                  "state": {
                    "type": "string",
                    "description": "Saved lifecycle or evidence state, as enumerated for this record."
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "description": "Recorded explanation; null when no explanation applies."
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Recorded explanation; null when no explanation applies."
                  },
                  "checked_at": {
                    "type": "string",
                    "description": "UTC timestamp of the saved check."
                  }
                },
                "required": [
                  "id",
                  "state",
                  "reason",
                  "checked_at"
                ],
                "additionalProperties": {},
                "description": "observation recorded for this result."
              },
              {
                "type": "null"
              }
            ],
            "description": "observation recorded for this result."
          },
          "usage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "unit": {
                    "type": "string",
                    "const": "source_check",
                    "description": "unit recorded for this result."
                  },
                  "units": {
                    "type": "number",
                    "description": "units recorded for this result."
                  },
                  "state": {
                    "type": "string",
                    "description": "Saved lifecycle or evidence state, as enumerated for this record."
                  },
                  "period": {
                    "description": "period recorded for this result.",
                    "type": "string"
                  }
                },
                "required": [
                  "unit",
                  "units",
                  "state"
                ],
                "additionalProperties": {},
                "description": "usage recorded for this result."
              },
              {
                "type": "null"
              }
            ],
            "description": "usage recorded for this result."
          }
        },
        "required": [
          "ordinal",
          "candidate_id",
          "local_reference",
          "job_id",
          "watch_id",
          "state",
          "error_code",
          "observation",
          "usage"
        ],
        "additionalProperties": {},
        "description": "Records in this bounded page."
      },
      "description": "Records in this bounded page."
    },
    "reservation": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "units": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "units recorded for this result."
            },
            "outstanding": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "outstanding recorded for this result."
            },
            "consumed": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "consumed recorded for this result."
            },
            "released": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "released recorded for this result."
            },
            "period": {
              "type": "string",
              "description": "period recorded for this result."
            }
          },
          "required": [
            "units",
            "outstanding",
            "consumed",
            "released",
            "period"
          ],
          "additionalProperties": {},
          "description": "reservation recorded for this result."
        },
        {
          "type": "null"
        }
      ],
      "description": "reservation recorded for this result."
    },
    "replayed": {
      "description": "True when the response reuses an earlier request with the same idempotency value.",
      "type": "boolean"
    },
    "recurring_monitoring_created": {
      "type": "boolean",
      "const": false,
      "description": "Whether this operation enrolled recurring monitoring."
    },
    "created_at": {
      "type": "string",
      "description": "UTC timestamp when the record was created."
    }
  },
  "required": [
    "schema_version",
    "id",
    "workspace_id",
    "project_id",
    "run_id",
    "state",
    "counts",
    "items",
    "reservation",
    "recurring_monitoring_created",
    "created_at"
  ],
  "additionalProperties": {}
}
