{
  "$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."
    },
    "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."
    },
    "competitor_binding": {
      "type": "object",
      "properties": {
        "setId": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,128}$"
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991,
          "description": "Revision of the approved competitor set bound to this offer or run. Pass the current set revision as revision when preparing an offer."
        },
        "memberId": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,128}$"
        }
      },
      "required": [
        "setId",
        "revision",
        "memberId"
      ],
      "additionalProperties": false
    },
    "scope": {
      "type": "object",
      "properties": {
        "domain": {
          "type": "string"
        },
        "include_subdomains": {
          "type": "boolean"
        }
      },
      "required": [
        "domain",
        "include_subdomains"
      ],
      "additionalProperties": false
    },
    "state": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "completed",
        "partial",
        "failed",
        "stopped"
      ],
      "description": "Saved lifecycle or evidence state, as enumerated for this record."
    },
    "stages": {
      "type": "object",
      "properties": {
        "retrieval": {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "enum": [
                "not_started",
                "pending",
                "running",
                "completed",
                "partial",
                "failed",
                "unavailable",
                "stopped"
              ],
              "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."
            },
            "updated_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
              "description": "UTC timestamp of the last record update."
            }
          },
          "required": [
            "state",
            "error_code",
            "updated_at"
          ],
          "additionalProperties": false
        },
        "source_checks": {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "enum": [
                "not_started",
                "pending",
                "running",
                "completed",
                "partial",
                "failed",
                "unavailable",
                "stopped"
              ],
              "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."
            },
            "updated_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
              "description": "UTC timestamp of the last record update."
            }
          },
          "required": [
            "state",
            "error_code",
            "updated_at"
          ],
          "additionalProperties": false
        },
        "occurrence_context": {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "enum": [
                "not_started",
                "pending",
                "running",
                "completed",
                "partial",
                "failed",
                "unavailable",
                "stopped"
              ],
              "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."
            },
            "updated_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
              "description": "UTC timestamp of the last record update."
            }
          },
          "required": [
            "state",
            "error_code",
            "updated_at"
          ],
          "additionalProperties": false
        },
        "assessment": {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "enum": [
                "not_started",
                "pending",
                "running",
                "completed",
                "partial",
                "failed",
                "unavailable",
                "stopped"
              ],
              "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."
            },
            "updated_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
              "description": "UTC timestamp of the last record update."
            }
          },
          "required": [
            "state",
            "error_code",
            "updated_at"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "retrieval",
        "source_checks",
        "occurrence_context",
        "assessment"
      ],
      "additionalProperties": false
    },
    "baseline_run_id": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,128}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "inventory_id": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,128}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
      "description": "UTC timestamp when the record was created."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
      "description": "UTC timestamp of the last record update."
    },
    "last_activity_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
    },
    "next_eligible_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
    },
    "retrieval_deadline": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
    },
    "attempt_count": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "retry_count": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "last_error_code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "recurring_monitoring_created": {
      "type": "boolean",
      "const": false,
      "description": "Whether this operation enrolled recurring monitoring."
    },
    "replayed": {
      "description": "True when the response reuses an earlier request with the same idempotency value.",
      "type": "boolean"
    }
  },
  "required": [
    "schema_version",
    "id",
    "workspace_id",
    "project_id",
    "competitor_binding",
    "scope",
    "state",
    "stages",
    "baseline_run_id",
    "inventory_id",
    "created_at",
    "updated_at",
    "last_activity_at",
    "next_eligible_at",
    "retrieval_deadline",
    "attempt_count",
    "retry_count",
    "last_error_code",
    "recurring_monitoring_created"
  ],
  "additionalProperties": false
}
