{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Published series feed",
  "type": "object",
  "required": [
    "version",
    "series"
  ],
  "properties": {
    "version": {
      "const": 1
    },
    "schemaVersion": {
      "type": "string"
    },
    "genres": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40
      }
    },
    "series": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/series"
      }
    }
  },
  "$defs": {
    "series": {
      "type": "object",
      "required": [
        "id",
        "title",
        "rating",
        "posterUrl"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,79}$"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "rating": {
          "type": "number",
          "minimum": 0,
          "maximum": 10
        },
        "year": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1880,
          "maximum": 2100
        },
        "summary": {
          "type": "string",
          "maxLength": 500
        },
        "genres": {
          "type": "array",
          "maxItems": 16,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "posterUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://[^/]+/"
        },
        "trending": {
          "type": "boolean",
          "default": false
        },
        "featured": {
          "type": "boolean",
          "default": false
        },
        "sortOrder": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9999,
          "default": 0
        },
        "status": {
          "enum": [
            "ongoing",
            "completed",
            "upcoming"
          ],
          "default": "ongoing"
        },
        "isDemo": {
          "type": "boolean",
          "default": false
        },
        "publishedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}
