{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,128}$",
      "description": "Resource identifier returned by the operation."
    },
    "baseline_run_id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,128}$"
    },
    "workspace_id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,128}$",
      "description": "Workspace that owns this record."
    },
    "project_id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,128}$",
      "description": "Project that owns this record."
    },
    "manifest_hash": {
      "type": "string",
      "minLength": 1
    },
    "cadence_seconds": {
      "type": "integer",
      "minimum": 3600,
      "maximum": 2592000
    },
    "state": {
      "type": "string",
      "enum": [
        "pending",
        "partial",
        "completed"
      ],
      "description": "Saved lifecycle or evidence state, as enumerated for this record."
    },
    "counts": {
      "type": "object",
      "properties": {
        "pending": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "created": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "description": "True when this request created the record; false when an existing record was reused."
        },
        "already_monitored": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "ineligible": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "failed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        }
      },
      "required": [
        "pending",
        "created",
        "already_monitored",
        "ineligible",
        "failed"
      ],
      "additionalProperties": false
    },
    "items": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "candidate_id": {
            "type": "string"
          },
          "verification_job_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,128}$"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "created",
              "already_monitored",
              "ineligible",
              "failed"
            ],
            "description": "Saved lifecycle or evidence state, as enumerated for this record."
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string",
                "description": "Latest delivery detail code; null when no failure or retry has been recorded."
              },
              {
                "type": "null"
              }
            ],
            "description": "Latest delivery detail code; null when no failure or retry has been recorded."
          },
          "watch_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,128}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "observation_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,128}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "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."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          }
        },
        "required": [
          "ordinal",
          "candidate_id",
          "verification_job_id",
          "state",
          "error_code",
          "watch_id",
          "observation_id",
          "local_reference",
          "attempt_count"
        ],
        "additionalProperties": false,
        "description": "Records in this bounded page."
      },
      "description": "Records in this bounded page."
    },
    "replayed": {
      "type": "boolean",
      "description": "True when the response reuses an earlier request with the same idempotency value."
    }
  },
  "required": [
    "schema_version",
    "id",
    "baseline_run_id",
    "workspace_id",
    "project_id",
    "manifest_hash",
    "cadence_seconds",
    "state",
    "counts",
    "items",
    "replayed"
  ],
  "additionalProperties": false
}
