{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "connection": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource identifier returned by the operation."
        },
        "project_id": {
          "type": "string",
          "description": "Project that owns this record."
        },
        "provider": {
          "type": "string",
          "enum": [
            "google",
            "bing"
          ]
        },
        "status": {
          "type": "string",
          "description": "Resource lifecycle status."
        },
        "property": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_sync_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "next_sync_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "coverage": {
          "anyOf": [
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "description": "Dataset scope and completeness, including limits on what these results establish."
              },
              "description": "Dataset scope and completeness, including limits on what these results establish."
            },
            {
              "type": "null"
            }
          ],
          "description": "Dataset scope and completeness, including limits on what these results establish."
        },
        "snapshot_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "capability": {
          "type": "string",
          "enum": [
            "search_performance",
            "backlinks"
          ]
        },
        "created_at": {
          "type": "string",
          "description": "UTC timestamp when the record was created."
        },
        "updated_at": {
          "type": "string",
          "description": "UTC timestamp of the last record update."
        }
      },
      "required": [
        "id",
        "project_id",
        "provider",
        "status",
        "property",
        "last_sync_at",
        "next_sync_at",
        "last_error",
        "coverage",
        "snapshot_id",
        "capability",
        "created_at",
        "updated_at"
      ],
      "additionalProperties": {}
    },
    "rows": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "rowId": {
                "type": "string"
              },
              "fetched_at": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "const": "search_performance"
              },
              "page": {
                "type": "string"
              },
              "query": {
                "type": "string"
              },
              "clicks": {
                "type": "number",
                "minimum": 0
              },
              "impressions": {
                "type": "number",
                "minimum": 0
              },
              "ctr": {
                "type": "number",
                "minimum": 0
              },
              "position": {
                "type": "number",
                "minimum": 0
              },
              "startDate": {
                "type": "string"
              },
              "endDate": {
                "type": "string"
              }
            },
            "required": [
              "rowId",
              "fetched_at",
              "kind",
              "page",
              "query",
              "clicks",
              "impressions",
              "ctr",
              "position",
              "startDate",
              "endDate"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "rowId": {
                "type": "string"
              },
              "fetched_at": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "const": "backlinks"
              },
              "source_url": {
                "type": "string",
                "description": "Publisher page URL recorded in this evidence."
              },
              "target_url": {
                "type": "string",
                "description": "Destination URL recorded in this evidence."
              },
              "anchor": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "supplier": {
                "type": "string",
                "const": "bing_webmaster_tools"
              },
              "verification_status": {
                "type": "string",
                "const": "unverified",
                "description": "AgentLinkOps check state, independent of supplier flags. not_checked means no AgentLinkOps check is recorded."
              }
            },
            "required": [
              "rowId",
              "fetched_at",
              "kind",
              "source_url",
              "target_url",
              "anchor",
              "supplier",
              "verification_status"
            ],
            "additionalProperties": {}
          }
        ]
      }
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "connection",
    "rows",
    "nextCursor"
  ],
  "additionalProperties": {}
}
