{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Parasocial additive catalog intake",
  "description": "Source-reviewed manual public records. The CLI additionally checks identity bindings, duplicate IDs and URLs, dates, platform hosts and count precision. This file is not an authorization to publish.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "creators",
    "enrichments",
    "content",
    "counts"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "creators": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "$ref": "#/$defs/creator"
      }
    },
    "enrichments": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "$ref": "#/$defs/enrichment"
      }
    },
    "content": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "$ref": "#/$defs/content"
      }
    },
    "counts": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "$ref": "#/$defs/count"
      }
    }
  },
  "$defs": {
    "creator": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "handle",
        "category",
        "bio",
        "initials",
        "color",
        "country",
        "accounts"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "minLength": 3,
          "maxLength": 100
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "handle": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "bio": {
          "type": "string",
          "minLength": 1,
          "maxLength": 600
        },
        "initials": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "color": {
          "type": "string",
          "pattern": "^#[A-Fa-f0-9]{6}$"
        },
        "country": {
          "const": "Not provided"
        },
        "accounts": {
          "type": "array",
          "minItems": 1,
          "maxItems": 17,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "platform",
              "handle",
              "url",
              "followers",
              "evidence",
              "sourceUrl",
              "lastChecked"
            ],
            "properties": {
              "platform": {
                "enum": [
                  "instagram",
                  "youtube",
                  "tiktok",
                  "twitch",
                  "x",
                  "threads",
                  "bluesky",
                  "facebook",
                  "linkedin",
                  "reddit",
                  "snapchat",
                  "pinterest",
                  "kick",
                  "discord",
                  "patreon",
                  "substack",
                  "website"
                ]
              },
              "handle": {
                "type": "string",
                "minLength": 1,
                "maxLength": 253
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 2048
              },
              "followers": {
                "type": "null"
              },
              "evidence": {
                "const": "public-source"
              },
              "sourceUrl": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 2048
              },
              "lastChecked": {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              }
            }
          }
        },
        "sourceNotes": {
          "type": "string",
          "minLength": 0,
          "maxLength": 1000
        },
        "addedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        }
      }
    },
    "account": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "platform",
        "handle",
        "url",
        "followers",
        "evidence",
        "sourceUrl",
        "lastChecked"
      ],
      "properties": {
        "platform": {
          "enum": [
            "instagram",
            "youtube",
            "tiktok",
            "twitch",
            "x",
            "threads",
            "bluesky",
            "facebook",
            "linkedin",
            "reddit",
            "snapchat",
            "pinterest",
            "kick",
            "discord",
            "patreon",
            "substack",
            "website"
          ]
        },
        "handle": {
          "type": "string",
          "minLength": 1,
          "maxLength": 253
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "followers": {
          "type": "null"
        },
        "evidence": {
          "const": "public-source"
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "lastChecked": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        }
      }
    },
    "enrichment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "creatorId",
        "inclusionReason",
        "discoverySource",
        "checkedAt",
        "topics",
        "links"
      ],
      "properties": {
        "creatorId": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "minLength": 3,
          "maxLength": 100
        },
        "inclusionReason": {
          "type": "string",
          "minLength": 20,
          "maxLength": 600
        },
        "discoverySource": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "checkedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "topics": {
          "type": "array",
          "minItems": 1,
          "maxItems": 12,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          }
        },
        "links": {
          "type": "array",
          "maxItems": 30,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "label",
              "kind",
              "url",
              "sourceUrl",
              "checkedAt"
            ],
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "kind": {
                "enum": [
                  "shop",
                  "membership",
                  "newsletter",
                  "book",
                  "course",
                  "podcast",
                  "project",
                  "community"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 2048
              },
              "sourceUrl": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 2048
              },
              "checkedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              }
            }
          }
        }
      }
    },
    "content": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "creatorId",
        "platform",
        "accountUrl",
        "url",
        "title",
        "summary",
        "format",
        "sourceUrl",
        "capturedAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{2,149}$",
          "minLength": 3,
          "maxLength": 150
        },
        "creatorId": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "minLength": 3,
          "maxLength": 100
        },
        "platform": {
          "enum": [
            "instagram",
            "youtube",
            "tiktok",
            "twitch",
            "x",
            "threads",
            "bluesky",
            "facebook",
            "linkedin",
            "reddit",
            "snapchat",
            "pinterest",
            "kick",
            "discord",
            "patreon",
            "substack",
            "website"
          ]
        },
        "accountUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "summary": {
          "type": "string",
          "minLength": 10,
          "maxLength": 600
        },
        "format": {
          "enum": [
            "video",
            "article",
            "post",
            "short",
            "audio"
          ]
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "publishedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "Z$"
            },
            {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          ]
        },
        "thumbnailUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "embedUrl": {
          "type": "string",
          "pattern": "^https://www\\.youtube-nocookie\\.com/embed/[A-Za-z0-9_-]{11}$"
        }
      }
    },
    "count": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "creatorId",
        "platform",
        "accountUrl",
        "sourceUrl",
        "nativeId",
        "followers",
        "metricDisplay",
        "metricLabel",
        "metricPrecision",
        "capturedAt",
        "method"
      ],
      "properties": {
        "creatorId": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "minLength": 3,
          "maxLength": 100
        },
        "platform": {
          "enum": [
            "instagram",
            "youtube",
            "tiktok",
            "twitch",
            "x",
            "threads",
            "bluesky",
            "facebook",
            "linkedin",
            "reddit",
            "snapchat",
            "pinterest",
            "kick",
            "discord",
            "patreon",
            "substack",
            "website"
          ]
        },
        "accountUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048
        },
        "nativeId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            {
              "type": "null"
            }
          ]
        },
        "followers": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "metricDisplay": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ]
        },
        "metricLabel": {
          "enum": [
            "followers",
            "subscribers"
          ]
        },
        "metricPrecision": {
          "enum": [
            "exact",
            "rounded"
          ]
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "method": {
          "const": "public-page"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "metricPrecision": {
                "const": "exact"
              }
            }
          },
          "then": {
            "properties": {
              "followers": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "else": {
            "properties": {
              "followers": {
                "type": "null"
              },
              "metricDisplay": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            }
          }
        }
      ]
    }
  }
}
