{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ondaclip.com/docs/publication.schema.json",
  "title": ".ondaclip/publication.yaml",
  "description": "The published tutorials, in chapters and optional sections. Docs: https://ondaclip.com/docs/publication-list/",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "chapters"
  ],
  "properties": {
    "sections": {
      "type": "array",
      "description": "Optional; when present, every chapter names one",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "title"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "title": {
            "description": "The section title",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "propertyNames": {
                  "pattern": "^[a-z]{2}-[A-Z]{2}$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "icon": {
            "type": "string"
          }
        }
      }
    },
    "chapters": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "number",
          "title",
          "tutorials"
        ],
        "properties": {
          "number": {
            "type": "integer",
            "minimum": 1,
            "description": "The order of the chapter; used once"
          },
          "section": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "title": {
            "description": "The chapter title",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "propertyNames": {
                  "pattern": "^[a-z]{2}-[A-Z]{2}$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "summary": {
            "description": "One sentence under the title",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "propertyNames": {
                  "pattern": "^[a-z]{2}-[A-Z]{2}$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "tutorials": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A tutorial file of the tutorials folder"
                },
                "icon": {
                  "type": "string"
                },
                "description": {
                  "description": "One sentence in the list",
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "propertyNames": {
                        "pattern": "^[a-z]{2}-[A-Z]{2}$"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "audience": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
