{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "request": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Resource identifier returned by the operation."
            },
            "projectId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "watchId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "state": {
              "type": "string",
              "enum": [
                "reserved",
                "dispatched",
                "completed",
                "uncertain",
                "cancelled"
              ],
              "description": "Saved lifecycle or evidence state, as enumerated for this record."
            },
            "createdAt": {
              "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+)?(?:Z))$"
            },
            "dispatchedAt": {
              "anyOf": [
                {
                  "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+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "completedAt": {
              "anyOf": [
                {
                  "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+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "cancelledAt": {
              "anyOf": [
                {
                  "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+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "providerTaskId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "errorCode": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "request": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "requestSha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "responseSha256": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "observation": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "observation_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "checked_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+)?(?:Z))$",
                      "description": "UTC timestamp of the saved check."
                    },
                    "tier": {
                      "type": "string",
                      "enum": [
                        "likely_indexed",
                        "not_found_in_site_query",
                        "unknown"
                      ]
                    },
                    "confidence": {
                      "type": "string",
                      "enum": [
                        "search_result_sample",
                        "unknown"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "description": "Recorded explanation."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "source_key": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "observation_id",
                    "checked_at",
                    "tier",
                    "confidence",
                    "reason",
                    "url",
                    "source_key"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "null"
                }
              ]
            },
            "evidenceAvailable": {
              "type": "boolean"
            },
            "rawResponse": {
              "anyOf": [
                {},
                {
                  "type": "null"
                }
              ]
            },
            "cost": {
              "type": "object",
              "properties": {
                "ceilingMicrousd": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actualMicrousd": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "reserved",
                    "dispatched",
                    "ambiguous",
                    "consumed",
                    "released",
                    "unavailable"
                  ],
                  "description": "Saved lifecycle or evidence state, as enumerated for this record."
                }
              },
              "required": [
                "ceilingMicrousd",
                "actualMicrousd",
                "state"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "id",
            "projectId",
            "watchId",
            "state",
            "createdAt",
            "dispatchedAt",
            "completedAt",
            "cancelledAt",
            "providerTaskId",
            "errorCode",
            "request",
            "requestSha256",
            "responseSha256",
            "observation",
            "evidenceAvailable",
            "rawResponse",
            "cost"
          ],
          "additionalProperties": {}
        },
        {
          "type": "null"
        }
      ]
    },
    "indexProjection": {
      "type": "object",
      "properties": {
        "receiptId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "retained",
            "metadata_only",
            "not_retained",
            "not_projected",
            "projection_unavailable"
          ],
          "description": "Resource lifecycle status."
        }
      },
      "required": [
        "receiptId",
        "status"
      ],
      "additionalProperties": {}
    }
  },
  "required": [
    "request",
    "indexProjection"
  ],
  "additionalProperties": {}
}
