{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "tracker": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "source": {
      "type": "string",
      "const": "x"
    },
    "evidence": {
      "type": "object",
      "properties": {
        "contentRevision": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "observation": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        }
      },
      "required": ["contentRevision", "observation"]
    },
    "content": {
      "type": "object",
      "properties": {
        "version": {
          "type": "number",
          "const": 1
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "authorId": {
          "type": "string",
          "minLength": 1
        },
        "publishedAt": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8640000000000000
        },
        "text": {
          "type": "string"
        },
        "isReply": {
          "type": "boolean"
        },
        "isRetweet": {
          "type": "boolean"
        },
        "isQuoteTweet": {
          "type": "boolean"
        },
        "media": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["type", "url"]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "mentionedAuthorIds": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "videoLengthSeconds": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "references": {
          "type": "object",
          "properties": {
            "replyId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "replyAuthorId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "quoteId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "quoteAuthorId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "repostId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "repostAuthorId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "replyId",
            "replyAuthorId",
            "quoteId",
            "quoteAuthorId",
            "repostId",
            "repostAuthorId"
          ]
        }
      },
      "required": [
        "version",
        "id",
        "authorId",
        "publishedAt",
        "text",
        "isReply",
        "isRetweet",
        "isQuoteTweet",
        "media",
        "mentionedAuthorIds",
        "videoLengthSeconds",
        "references"
      ]
    },
    "observedAt": {
      "type": "integer",
      "minimum": 0,
      "maximum": 8640000000000000
    },
    "removed": {
      "type": "boolean"
    },
    "attribution": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "member": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "capturedAt": {
              "type": "integer",
              "minimum": 0,
              "maximum": 8640000000000000
            },
            "kind": {
              "type": "string",
              "const": "linked"
            },
            "account": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "x"
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "subject": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "revision": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "linkedAt": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 8640000000000000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "provider",
                "issuer",
                "subject",
                "revision",
                "linkedAt"
              ]
            }
          },
          "required": ["member", "capturedAt", "kind", "account"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "member": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "capturedAt": {
              "type": "integer",
              "minimum": 0,
              "maximum": 8640000000000000
            },
            "kind": {
              "type": "string",
              "const": "unlinked"
            }
          },
          "required": ["member", "capturedAt", "kind"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "member": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "capturedAt": {
              "type": "integer",
              "minimum": 0,
              "maximum": 8640000000000000
            },
            "kind": {
              "type": "string",
              "const": "different-author"
            }
          },
          "required": ["member", "capturedAt", "kind"],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "tracker",
    "source",
    "evidence",
    "content",
    "observedAt",
    "removed",
    "attribution"
  ]
}
