{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "v": {
      "type": "number",
      "const": 1
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-zA-Z0-9_-]+$",
      "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."
    },
    "provider": {
      "type": "string",
      "enum": [
        "linktrail_corpus",
        "dataforseo",
        "imported"
      ]
    },
    "data_mode": {
      "type": "string",
      "enum": [
        "synthetic",
        "owned_corpus",
        "provider_index",
        "imported"
      ]
    },
    "query": {
      "type": "object",
      "properties": {
        "target_kind": {
          "type": "string",
          "enum": [
            "domain",
            "exact_url"
          ]
        },
        "target": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "include_subdomains": {
          "type": "boolean"
        },
        "backlinks_status_type": {
          "type": "string",
          "enum": [
            "live",
            "lost",
            "all"
          ]
        },
        "exclude_internal_backlinks": {
          "type": "boolean"
        },
        "mode": {
          "type": "string",
          "const": "as_is"
        },
        "filters": {
          "type": "null"
        },
        "order_by": {
          "type": "array",
          "prefixItems": [
            {
              "type": "string",
              "enum": [
                "first_seen,desc",
                "rank,desc",
                "as_supplied"
              ]
            }
          ],
          "items": false,
          "minItems": 1,
          "maxItems": 1
        },
        "rank_scale": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "one_thousand"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "page_limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        },
        "row_limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        }
      },
      "required": [
        "target_kind",
        "target",
        "include_subdomains",
        "backlinks_status_type",
        "exclude_internal_backlinks",
        "mode",
        "filters",
        "order_by",
        "rank_scale",
        "page_limit",
        "row_limit"
      ],
      "additionalProperties": false
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "partial",
        "failed",
        "reconciliation_required"
      ],
      "description": "Resource lifecycle status."
    },
    "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."
    },
    "started_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"
        }
      ]
    },
    "finished_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"
        }
      ]
    },
    "coverage": {
      "type": "string",
      "enum": [
        "pending",
        "complete_for_query",
        "capped",
        "partial",
        "unknown"
      ],
      "description": "Dataset scope and completeness, including limits on what these results establish."
    },
    "coverage_reason": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ]
    },
    "provider_total_count": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "usage": {
      "type": "object",
      "properties": {
        "unit": {
          "type": "string",
          "const": "discovery"
        },
        "currency": {
          "type": "string",
          "const": "USD"
        },
        "quote_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "max_cost_microusd": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "reserved_cost_microusd": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "provider_reported_cost_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "request_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "returned_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "accepted_candidates": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "rejected_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "duplicate_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "unit",
        "currency",
        "quote_id",
        "max_cost_microusd",
        "reserved_cost_microusd",
        "provider_reported_cost_microusd",
        "request_count",
        "returned_rows",
        "accepted_candidates",
        "rejected_rows",
        "duplicate_rows"
      ],
      "additionalProperties": false
    },
    "operation": {
      "type": "string",
      "const": "backlinks"
    },
    "coverage_scope": {
      "type": "string",
      "enum": [
        "customer_import",
        "corpus_subset",
        "provider_query"
      ]
    },
    "whole_web_coverage": {
      "type": "boolean",
      "const": false,
      "description": "False: these results do not measure the whole web."
    },
    "replayed": {
      "description": "True when the response reuses an earlier request with the same idempotency value.",
      "type": "boolean"
    },
    "admission": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "operation_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "project_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Project that owns this record."
            },
            "context": {
              "type": "string",
              "enum": [
                "import",
                "candidate",
                "candidate_batch",
                "serve"
              ]
            },
            "decisions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "index": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "url": {
                    "type": "string"
                  },
                  "normalized_url": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "host": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "admitted",
                      "rejected"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "description": "Recorded explanation; null when no explanation applies."
                  },
                  "rule_kind": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rule_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rule_value": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cap": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "limit": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "used": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "limit",
                          "used"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subject_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "index",
                  "url",
                  "normalized_url",
                  "host",
                  "decision",
                  "reason",
                  "rule_kind",
                  "rule_id",
                  "rule_value",
                  "cap",
                  "subject_key"
                ],
                "additionalProperties": false
              }
            },
            "summary": {
              "type": "object",
              "properties": {
                "total": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "admitted": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "rejected": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "by_rule": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              },
              "required": [
                "total",
                "admitted",
                "rejected",
                "by_rule"
              ],
              "additionalProperties": false,
              "description": "Grouped change counts included in this delivery, limited to accessible websites."
            },
            "policy_revision": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "disavow_revision": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "replayed": {
              "type": "boolean",
              "description": "True when the response reuses an earlier request with the same idempotency value."
            }
          },
          "required": [
            "operation_id",
            "project_id",
            "context",
            "decisions",
            "summary",
            "policy_revision",
            "disavow_revision",
            "replayed"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "rejected": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number"
          },
          "reason": {
            "type": "string",
            "description": "Recorded explanation; null when no explanation applies."
          },
          "admission": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "url": {
                "type": "string"
              },
              "normalized_url": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "host": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "decision": {
                "type": "string",
                "enum": [
                  "admitted",
                  "rejected"
                ]
              },
              "reason": {
                "type": "string",
                "description": "Recorded explanation; null when no explanation applies."
              },
              "rule_kind": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "rule_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "rule_value": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cap": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "limit": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "used": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "limit",
                      "used"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject_key": {
                "type": "string"
              }
            },
            "required": [
              "index",
              "url",
              "normalized_url",
              "host",
              "decision",
              "reason",
              "rule_kind",
              "rule_id",
              "rule_value",
              "cap",
              "subject_key"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "row",
          "reason"
        ],
        "additionalProperties": {}
      }
    },
    "duplicates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number"
          },
          "first_seen_on_row": {
            "type": "number"
          }
        },
        "required": [
          "row",
          "first_seen_on_row"
        ],
        "additionalProperties": {}
      }
    },
    "rejected_total": {
      "type": "number"
    },
    "duplicates_total": {
      "type": "number"
    }
  },
  "required": [
    "v",
    "id",
    "workspace_id",
    "project_id",
    "provider",
    "data_mode",
    "query",
    "status",
    "created_at",
    "started_at",
    "finished_at",
    "coverage",
    "coverage_reason",
    "provider_total_count",
    "usage",
    "operation",
    "coverage_scope",
    "whole_web_coverage",
    "rejected",
    "duplicates",
    "rejected_total",
    "duplicates_total"
  ],
  "additionalProperties": {}
}
