{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "content-feed.schema.json",
  "title": "Generic external fixture content feed snapshot",
  "type": "object",
  "required": [
    "fixtureId",
    "feedKey",
    "snapshotAt",
    "items"
  ],
  "properties": {
    "fixtureId": {
      "type": "string",
      "minLength": 1
    },
    "feedKey": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "snapshotAt": {
      "type": "string",
      "format": "date-time"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/contentItem"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "fixtureIndex": {
      "description": "Response of GET /v1/fixtures. Each entry names a fixture and the feed keys it serves; an integration view defines the entry's descriptive fields.",
      "type": "object",
      "required": [
        "fixtures"
      ],
      "properties": {
        "fixtures": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "fixtureId",
              "feeds"
            ],
            "properties": {
              "fixtureId": {
                "type": "string",
                "minLength": 1
              },
              "feeds": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                }
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "entity": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "displayName"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "minLength": 1
        },
        "displayName": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "asset": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "href",
        "mediaType",
        "altText"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "minLength": 1
        },
        "href": {
          "type": "string",
          "format": "uri-reference"
        },
        "mediaType": {
          "type": "string",
          "minLength": 1
        },
        "altText": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "contentItem": {
      "type": "object",
      "required": [
        "id",
        "fixtureId",
        "definitionKey",
        "definitionVersion",
        "revision",
        "effectiveAt",
        "asOf",
        "publishedAt",
        "entities",
        "content",
        "assets"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "fixtureId": {
          "type": "string",
          "minLength": 1
        },
        "definitionKey": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:[.-][a-z0-9-]+)+$"
        },
        "definitionVersion": {
          "type": "integer",
          "minimum": 1
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        },
        "effectiveAt": {
          "type": "string",
          "format": "date-time"
        },
        "asOf": {
          "type": "string",
          "format": "date-time"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "entities": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/entity"
          }
        },
        "content": {
          "type": "object"
        },
        "assets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/asset"
          }
        }
      },
      "additionalProperties": false
    }
  }
}
