{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pingfanfan.github.io/OpenWebsite/schema/knowledge-page.schema.json",
  "title": "KnowledgePage",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "id",
    "url",
    "rawUrl",
    "apiUrl",
    "title",
    "summary",
    "lastUpdated",
    "version",
    "audience",
    "sourceOfTruth",
    "tags",
    "sections",
    "relatedPages"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
    },
    "format": {
      "const": "knowledge-page"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "url": {
      "type": "string",
      "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
    },
    "rawUrl": {
      "type": "string",
      "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
    },
    "apiUrl": {
      "type": "string",
      "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
    },
    "schemaUrl": {
      "type": "string",
      "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "summary": {
      "type": "string",
      "minLength": 1
    },
    "lastUpdated": {
      "type": "string",
      "format": "date"
    },
    "version": {
      "type": "string",
      "pattern": "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "audience": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": ["ai-agent", "crawler", "developer", "human"]
      },
      "uniqueItems": true,
      "minItems": 1
    },
    "sourceOfTruth": {
      "type": "string",
      "minLength": 1
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "sections": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "title", "summary", "content"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9-]+$"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "content": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "minItems": 1
          }
        }
      }
    },
    "relatedPages": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "title", "url"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9-]+$"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string",
            "pattern": "^(https://pingfanfan\\.github\\.io/OpenWebsite/|/)"
          }
        }
      }
    }
  }
}
