{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tylereno.me/cel/schemas/feed_matrix.json",
  "title": "CelFeedMatrix",
  "description": "Catalog of open ingest sources Sentinel should poll. Dictionary only — not a fetcher. cel_codes must be speakable CEL incident words.",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "version", "cel_spec", "title", "sources"],
  "properties": {
    "id": {
      "type": "string",
      "const": "cel.feeds.matrix"
    },
    "version": { "type": "string", "minLength": 1 },
    "cel_spec": { "type": "string", "const": "0.1.0" },
    "title": { "type": "string", "minLength": 1 },
    "description": { "type": "string" },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/source" }
    }
  },
  "$defs": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "provider",
        "title",
        "kind",
        "url",
        "cel_codes",
        "ingest_status"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "provider": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1 },
        "kind": {
          "type": "string",
          "enum": ["rss", "atom", "cap", "geojson", "rest", "csv"]
        },
        "url": { "type": "string", "minLength": 1 },
        "cadence": { "type": "string" },
        "cel_codes": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^disaster(\\.[a-z][a-z0-9_]*)+$"
          }
        },
        "ingest_status": {
          "type": "string",
          "enum": ["implemented", "planned"],
          "description": "implemented means Sentinel already has an adapter. planned is still a CEL-named source."
        },
        "attribution": { "type": "string" },
        "notes": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  }
}
