{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "workspace_id": {
      "type": "string",
      "description": "Workspace that owns this record."
    },
    "project_id": {
      "type": "string",
      "description": "Project that owns this record."
    },
    "run_id": {
      "type": "string"
    },
    "candidate_id": {
      "type": "string"
    },
    "watch_id": {
      "type": "string"
    },
    "job_id": {
      "type": "string"
    },
    "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."
    },
    "created_at": {
      "type": "string",
      "description": "UTC timestamp when the record was created."
    },
    "candidate": {
      "type": "object",
      "properties": {
        "v": {
          "type": "number",
          "const": 1
        },
        "id": {
          "type": "string",
          "pattern": "^dc_[a-f0-9]{64}$",
          "description": "Resource identifier returned by the operation."
        },
        "workspace_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-zA-Z0-9_-]+$",
          "description": "Workspace that owns this record."
        },
        "project_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-zA-Z0-9_-]+$",
          "description": "Project that owns this record."
        },
        "discovery_run_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "source_url": {
          "type": "string",
          "maxLength": 4096,
          "description": "Publisher page URL recorded in this evidence."
        },
        "target_url": {
          "type": "string",
          "maxLength": 4096,
          "description": "Destination URL recorded in this evidence."
        },
        "provider": {
          "type": "string",
          "enum": [
            "linktrail_corpus",
            "dataforseo",
            "imported"
          ]
        },
        "data_mode": {
          "type": "string",
          "enum": [
            "synthetic",
            "owned_corpus",
            "provider_index",
            "imported"
          ]
        },
        "provider_retrieved_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": "Timestamp when the upstream evidence was retrieved."
        },
        "provider_first_seen": {
          "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{3}(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "provider_prev_seen": {
          "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{3}(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "provider_last_seen": {
          "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{3}(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "provider_status": {
          "type": "object",
          "properties": {
            "is_lost": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            },
            "is_broken": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            },
            "is_new": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "is_lost",
            "is_broken",
            "is_new"
          ],
          "additionalProperties": false
        },
        "anchor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "null"
            }
          ]
        },
        "rel": {
          "anyOf": [
            {
              "maxItems": 32,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "dofollow": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "link_type": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64
            },
            {
              "type": "null"
            }
          ]
        },
        "source_http_status": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            {
              "type": "null"
            }
          ]
        },
        "target_http_status": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            {
              "type": "null"
            }
          ]
        },
        "links_count": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "provider_metrics": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "dataforseo": {
                  "type": "object",
                  "properties": {
                    "rank": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "page_from_rank": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "domain_from_rank": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "backlink_spam_score": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rank_scale": {
                      "type": "string",
                      "const": "one_thousand"
                    }
                  },
                  "required": [
                    "rank",
                    "page_from_rank",
                    "domain_from_rank",
                    "backlink_spam_score",
                    "rank_scale"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "dataforseo"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "imported": {
                  "type": "object",
                  "properties": {
                    "supplier": {
                      "type": "string",
                      "enum": [
                        "ahrefs",
                        "google_search_console",
                        "bing_webmaster_tools",
                        "semrush",
                        "majestic",
                        "moz",
                        "dataforseo",
                        "linkody",
                        "csv"
                      ]
                    },
                    "supplier_row_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 256
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supplier_generated_at": {
                      "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{3}(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supplier_metrics": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "string",
                                "maxLength": 256
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "supplier",
                    "supplier_row_id",
                    "supplier_generated_at",
                    "supplier_metrics"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "imported"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "linktrail_corpus": {
                  "type": "object",
                  "properties": {
                    "source_outlink_count": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "source_external_outlink_count": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fetch_kind": {
                      "type": "string",
                      "enum": [
                        "direct",
                        "rendered",
                        "proxied"
                      ]
                    },
                    "extraction_complete": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "source_outlink_count",
                    "source_external_outlink_count",
                    "fetch_kind",
                    "extraction_complete"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "linktrail_corpus"
              ],
              "additionalProperties": false
            }
          ]
        },
        "verification_status": {
          "type": "string",
          "enum": [
            "not_checked",
            "present",
            "absent",
            "unknown",
            "source_unavailable"
          ],
          "description": "AgentLinkOps check state, independent of supplier flags. not_checked means no AgentLinkOps check is recorded."
        },
        "verified_at": {
          "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{3}(?:Z))$",
              "description": "Timestamp of the AgentLinkOps check; null until checked."
            },
            {
              "type": "null"
            }
          ],
          "description": "Timestamp of the AgentLinkOps check; null until checked."
        },
        "observation_id": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "v",
        "id",
        "workspace_id",
        "project_id",
        "discovery_run_id",
        "source_url",
        "target_url",
        "provider",
        "data_mode",
        "provider_retrieved_at",
        "provider_first_seen",
        "provider_prev_seen",
        "provider_last_seen",
        "provider_status",
        "anchor",
        "rel",
        "dofollow",
        "link_type",
        "source_http_status",
        "target_http_status",
        "links_count",
        "provider_metrics",
        "verification_status",
        "verified_at",
        "observation_id"
      ],
      "additionalProperties": {}
    },
    "job": {
      "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."
        },
        "execution_mode": {
          "type": "string"
        },
        "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."
        },
        "created_at": {
          "type": "string",
          "description": "UTC timestamp when the record was created."
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "usage": {
          "type": "object",
          "properties": {
            "unit": {
              "type": "string",
              "const": "source_check"
            },
            "units": {
              "type": "number"
            },
            "state": {
              "description": "Saved lifecycle or evidence state, as enumerated for this record.",
              "type": "string"
            },
            "period": {
              "type": "string"
            }
          },
          "required": [
            "unit"
          ],
          "additionalProperties": {}
        }
      },
      "required": [
        "id",
        "state",
        "execution_mode",
        "error_code",
        "created_at",
        "completed_at",
        "usage"
      ],
      "additionalProperties": {}
    },
    "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": {}
        },
        {
          "type": "null"
        }
      ]
    },
    "watch": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource identifier returned by the operation."
        },
        "status": {
          "type": "string",
          "description": "Resource lifecycle status."
        },
        "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."
        }
      },
      "required": [
        "id",
        "status",
        "local_reference"
      ],
      "additionalProperties": {}
    },
    "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",
    "workspace_id",
    "project_id",
    "run_id",
    "candidate_id",
    "watch_id",
    "job_id",
    "local_reference",
    "created_at",
    "candidate",
    "job",
    "observation",
    "watch",
    "recurring_monitoring_created"
  ],
  "additionalProperties": {}
}
