{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "v": {
      "type": "number",
      "const": 1,
      "description": "v recorded for this result."
    },
    "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"
      ],
      "description": "provider recorded for this result."
    },
    "data_mode": {
      "type": "string",
      "enum": [
        "synthetic",
        "owned_corpus",
        "provider_index",
        "imported"
      ],
      "description": "data mode recorded for this result."
    },
    "query": {
      "type": "object",
      "properties": {
        "target_kind": {
          "type": "string",
          "enum": [
            "domain",
            "exact_url"
          ],
          "description": "target kind recorded for this result."
        },
        "target": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096,
          "description": "target recorded for this result."
        },
        "include_subdomains": {
          "type": "boolean",
          "description": "include subdomains recorded for this result."
        },
        "backlinks_status_type": {
          "type": "string",
          "enum": [
            "live",
            "lost",
            "all"
          ],
          "description": "backlinks status type recorded for this result."
        },
        "exclude_internal_backlinks": {
          "type": "boolean",
          "description": "exclude internal backlinks recorded for this result."
        },
        "mode": {
          "type": "string",
          "const": "as_is",
          "description": "mode recorded for this result."
        },
        "filters": {
          "type": "null",
          "description": "filters recorded for this result."
        },
        "order_by": {
          "type": "array",
          "prefixItems": [
            {
              "type": "string",
              "enum": [
                "first_seen,desc",
                "rank,desc",
                "as_supplied"
              ]
            }
          ],
          "items": false,
          "minItems": 1,
          "maxItems": 1,
          "description": "order by recorded for this result."
        },
        "rank_scale": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "one_thousand"
              ],
              "description": "rank scale recorded for this result."
            },
            {
              "type": "null"
            }
          ],
          "description": "rank scale recorded for this result."
        },
        "page_limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "page limit recorded for this result."
        },
        "row_limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "row limit recorded for this result."
        }
      },
      "required": [
        "target_kind",
        "target",
        "include_subdomains",
        "backlinks_status_type",
        "exclude_internal_backlinks",
        "mode",
        "filters",
        "order_by",
        "rank_scale",
        "page_limit",
        "row_limit"
      ],
      "additionalProperties": false,
      "description": "query recorded for this result."
    },
    "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))$",
          "description": "started at recorded for this result."
        },
        {
          "type": "null"
        }
      ],
      "description": "started at recorded for this result."
    },
    "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))$",
          "description": "finished at recorded for this result."
        },
        {
          "type": "null"
        }
      ],
      "description": "finished at recorded for this result."
    },
    "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,
          "description": "coverage reason recorded for this result."
        },
        {
          "type": "null"
        }
      ],
      "description": "coverage reason recorded for this result."
    },
    "provider_total_count": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "provider total count recorded for this result."
        },
        {
          "type": "null"
        }
      ],
      "description": "provider total count recorded for this result."
    },
    "usage": {
      "type": "object",
      "properties": {
        "unit": {
          "type": "string",
          "const": "discovery",
          "description": "unit recorded for this result."
        },
        "currency": {
          "type": "string",
          "const": "USD",
          "description": "currency recorded for this result."
        },
        "quote_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-zA-Z0-9_-]+$",
          "description": "quote id recorded for this result."
        },
        "max_cost_microusd": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "max cost microusd recorded for this result."
        },
        "reserved_cost_microusd": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "reserved cost microusd recorded for this result."
        },
        "provider_reported_cost_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "provider reported cost microusd recorded for this result."
            },
            {
              "type": "null"
            }
          ],
          "description": "provider reported cost microusd recorded for this result."
        },
        "request_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "request count recorded for this result."
        },
        "returned_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "returned rows recorded for this result."
        },
        "accepted_candidates": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "accepted candidates recorded for this result."
        },
        "rejected_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "rejected rows recorded for this result."
        },
        "duplicate_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "duplicate rows recorded for this result."
        }
      },
      "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,
      "description": "usage recorded for this result."
    },
    "operation": {
      "type": "string",
      "const": "backlinks",
      "description": "operation recorded for this result."
    },
    "coverage_scope": {
      "type": "string",
      "enum": [
        "customer_import",
        "corpus_subset",
        "provider_query"
      ],
      "description": "coverage scope recorded for this result."
    },
    "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"
    },
    "rejected": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number",
            "description": "row recorded for this result."
          },
          "reason": {
            "type": "string",
            "description": "Recorded explanation; null when no explanation applies."
          }
        },
        "required": [
          "row",
          "reason"
        ],
        "additionalProperties": {},
        "description": "rejected recorded for this result."
      },
      "description": "rejected recorded for this result."
    },
    "duplicates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number",
            "description": "row recorded for this result."
          },
          "first_seen_on_row": {
            "type": "number",
            "description": "first seen on row recorded for this result."
          }
        },
        "required": [
          "row",
          "first_seen_on_row"
        ],
        "additionalProperties": {},
        "description": "duplicates recorded for this result."
      },
      "description": "duplicates recorded for this result."
    },
    "rejected_total": {
      "type": "number",
      "description": "rejected total recorded for this result."
    },
    "duplicates_total": {
      "type": "number",
      "description": "duplicates total recorded for this result."
    }
  },
  "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": {}
}
