{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://zeropress.dev/schemas/preview-data.v0.2.schema.json",
  "title": "ZeroPress Theme Preview Data v0.2",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "generator", "generated_at", "site", "content", "routes"],
  "properties": {
    "version": {
      "const": "0.2"
    },
    "generator": {
      "type": "string",
      "minLength": 1
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "site": {
      "$ref": "#/$defs/site"
    },
    "content": {
      "$ref": "#/$defs/content"
    },
    "routes": {
      "$ref": "#/$defs/routes"
    }
  },
  "$defs": {
    "site": {
      "type": "object",
      "required": ["title", "description", "url", "language"],
      "properties": {
        "title": { "type": "string", "minLength": 1 },
        "description": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "language": { "type": "string", "minLength": 2 },
        "logo": { "type": "string", "format": "uri" },
        "social": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "previewPost": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "public_id",
        "title",
        "slug",
        "html",
        "excerpt",
        "published_at",
        "updated_at",
        "published_at_iso",
        "updated_at_iso",
        "reading_time",
        "author_name",
        "categories_html",
        "tags_html",
        "comments_html",
        "status"
      ],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "public_id": { "type": "integer", "minimum": 1 },
        "title": { "type": "string", "minLength": 1 },
        "slug": { "type": "string", "minLength": 1 },
        "html": { "type": "string" },
        "excerpt": { "type": "string" },
        "published_at": { "type": "string" },
        "updated_at": { "type": "string" },
        "published_at_iso": { "type": "string", "format": "date-time" },
        "updated_at_iso": { "type": "string", "format": "date-time" },
        "reading_time": { "type": "string", "minLength": 1 },
        "author_name": { "type": "string", "minLength": 1 },
        "author_avatar": { "type": "string", "format": "uri" },
        "featured_image": { "type": "string", "format": "uri" },
        "categories_html": { "type": "string" },
        "tags_html": { "type": "string" },
        "comments_html": { "type": "string" },
        "status": {
          "type": "string",
          "enum": ["published", "draft"]
        }
      }
    },
    "previewPage": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "title", "slug", "html", "status"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1 },
        "slug": { "type": "string", "minLength": 1 },
        "html": { "type": "string" },
        "status": {
          "type": "string",
          "enum": ["published", "draft"]
        }
      }
    },
    "previewCategory": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "name", "slug", "postCount"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "name": { "type": "string", "minLength": 1 },
        "slug": { "type": "string", "minLength": 1 },
        "description": { "type": "string" },
        "postCount": { "type": "integer", "minimum": 0 }
      }
    },
    "previewTag": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "name", "slug", "postCount"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "name": { "type": "string", "minLength": 1 },
        "slug": { "type": "string", "minLength": 1 },
        "postCount": { "type": "integer", "minimum": 0 }
      }
    },
    "content": {
      "type": "object",
      "additionalProperties": false,
      "required": ["posts", "pages", "categories", "tags"],
      "properties": {
        "posts": {
          "type": "array",
          "items": { "$ref": "#/$defs/previewPost" }
        },
        "pages": {
          "type": "array",
          "items": { "$ref": "#/$defs/previewPage" }
        },
        "categories": {
          "type": "array",
          "items": { "$ref": "#/$defs/previewCategory" }
        },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/previewTag" }
        }
      }
    },
    "routeBlocks": {
      "type": "object",
      "additionalProperties": false,
      "required": ["posts", "pagination"],
      "properties": {
        "posts": { "type": "string" },
        "pagination": { "type": "string" },
        "categories": { "type": "string" },
        "tags": { "type": "string" }
      }
    },
    "categoryRoute": {
      "type": "object",
      "additionalProperties": false,
      "required": ["slug", "posts", "pagination"],
      "properties": {
        "slug": { "type": "string", "minLength": 1 },
        "posts": { "type": "string" },
        "pagination": { "type": "string" },
        "categories": { "type": "string" }
      }
    },
    "tagRoute": {
      "type": "object",
      "additionalProperties": false,
      "required": ["slug", "posts", "pagination"],
      "properties": {
        "slug": { "type": "string", "minLength": 1 },
        "posts": { "type": "string" },
        "pagination": { "type": "string" },
        "tags": { "type": "string" }
      }
    },
    "routes": {
      "type": "object",
      "additionalProperties": false,
      "required": ["index", "archive", "categories", "tags"],
      "properties": {
        "index": {
          "allOf": [
            { "$ref": "#/$defs/routeBlocks" },
            {
              "required": ["posts", "categories", "tags", "pagination"]
            }
          ]
        },
        "archive": {
          "$ref": "#/$defs/routeBlocks"
        },
        "categories": {
          "type": "array",
          "items": { "$ref": "#/$defs/categoryRoute" }
        },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/tagRoute" }
        }
      }
    }
  }
}
