{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://iramiller.com/data/schemas/sources.schema.json",
  "title": "Ira Miller sources and cross-posts",
  "type": "object",
  "required": ["version", "items"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "type": "string" },
    "version": { "type": "integer", "minimum": 1 },
    "updated": { "type": "string" },
    "items": {
      "type": "array",
      "items": { "$ref": "#/$defs/item" }
    }
  },
  "$defs": {
    "item": {
      "type": "object",
      "required": ["id", "kind", "title", "network", "url", "host"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "kind": {
          "enum": [
            "channel",
            "cross-post",
            "video-own",
            "video-third",
            "mention",
            "embed"
          ]
        },
        "title": { "type": "string", "minLength": 1 },
        "network": {
          "enum": [
            "site",
            "instagram",
            "facebook",
            "youtube",
            "linkedin",
            "github",
            "web",
            "other"
          ]
        },
        "url": { "type": "string", "minLength": 1 },
        "host": { "enum": ["own", "third"] },
        "piece": {
          "type": "string",
          "description": "Site path of the related piece, e.g. /poetry/slug/"
        },
        "post": {
          "type": "string",
          "description": "Internal post id when known, e.g. fb-…"
        },
        "published": { "type": "string" },
        "status": { "enum": ["live", "gone", "pending"] },
        "notes": { "type": "string" }
      }
    }
  }
}
