oneOf:
  - { $ref: '#/$defs/project' }

  - additionalProperties: false
    properties:
      primary_language:
        type: string
      languages:
        patternProperties:
          .+: { $ref: '#/$defs/project' }

  - additionalProperties: false
    properties:
      volumes:
        patternProperties:
          .+: { $ref: '#/$defs/project' }

  - additionalProperties: false
    properties:
      primary_language:
        type: string
      languages:
        patternProperties:
          .+:
            additionalProperties: false
            properties:
              volumes:
                patternProperties:
                  .+: { $ref: '#/$defs/project' }

$defs:
  project:
    additionalProperties: false
    properties:
      title: { type: string }

      paths:
        additionalProperties: false
        properties:
          root: { type: string }
          include:
            type: array
            minItems: 0
            items:
              type: string
          exclude:
            type: array
            minItems: 0
            items:
              type: string
          naming_scheme:
            type: array
            minItems: 0
            uniqueItems: true
            items:
              type: string
              format: regex
          resources: { type: string }
          partials: { type: string }

      content:
        additionalProperties: false
        properties:
          numeration: { type: boolean }
          emoji_replacements:
            additionalProperties: false
            patternProperties:
              .*:
                type: string
                pattern: ^/.+

      web:
        additionalProperties: false
        properties:
          prefix: { type: string }
          resources_prefix: { type: string }
          resources_force_copy:
            type: array
            items:
              type: string
          processor: { type: string }
          theme:
            oneOf:
              - enum: [book, material, raw, simple, sobiraka2025]

              - type: string
                not: { enum: [book, material, raw, simple, sobiraka2025] }

              - type: object
                additionalProperties: false
                properties:
                  name: { const: sobiraka2025 }
                  flavor: { enum: [green] }
                  customization: { type: string }
                required:
                  - name

              - type: object
                additionalProperties: false
                properties:
                  name:
                    oneOf:
                      - enum: [book, material, raw, simple]
                      - type: string
                        not: { enum: [book, material, raw, simple, sobiraka2025] }
                  flavor: { type: string }
                  customization: { type: string }
                required:
                  - name

          theme_data: { type: object }
          custom_scripts:
            type: array
            uniqueItems: true
            items: { type: string }
          custom_styles:
            type: array
            uniqueItems: true
            items: { type: string }
          toc_depth:
            oneOf:
              - type: integer
              - enum: [infinity]
          combined_toc:
            enum: [never, current, always]
          search:
            additionalProperties: false
            properties:
              engine:
                enum: [pagefind]
              generate_js: { type: boolean }
              container: { type: string }
              index_path: { type: string }
              skip_elements:
                type: array
                uniqueItems: true
                items:
                  enum: [BlockQuote, BulletList, Caption, Citation, Cite, Code, CodeBlock, Definition, DefinitionItem, DefinitionList, Div, Doc, Emph, Header, HorizontalRule, Image, LineBlock, LineBreak, LineItem, Link, ListContainer, ListItem, Math, Note, Null, OrderedList, Para, Plain, Quoted, RawBlock, RawInline, SmallCaps, SoftBreak, Space, Span, Str, Strikeout, Strong, Subscript, Superscript, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Underline]
              link_target:
                enum: [h1, h2, h3, h4, h5, h6]
              translations:
                additionalProperties: false
                properties:
                  placeholder: { type: string }
                  clear_search: { type: string }
                  load_more: { type: string }
                  search_label: { type: string }
                  filters_label: { type: string }
                  zero_results: { type: string }
                  many_results: { type: string }
                  one_result: { type: string }
                  alt_search: { type: string }
                  search_suggestion: { type: string }
                  searching: { type: string }
          highlight:
            oneOf:
              - enum: [highlightjs, prism, pygments]
              - additionalProperties: false
                properties:
                  highlightjs:
                    additionalProperties: false
                    properties:
                      version:
                        oneOf:
                          - type: integer
                          - type: string
                            pattern: \d+\.\d+(\.\d+)?
                      location:
                        oneOf:
                          - enum: [cdnjs, jsdelivr, unpkg]
                          - type: string
                            pattern: ^(\./|https://)
                      style:
                        enum: [1c-light, a11y-dark, a11y-light, agate, an-old-hope, androidstudio, arduino-light, arta, ascetic, atom-one-dark-reasonable, atom-one-dark, atom-one-light, base16-3024, base16-apathy, base16-apprentice, base16-ashes, base16-atelier-cave-light, base16-atelier-cave, base16-atelier-dune-light, base16-atelier-dune, base16-atelier-estuary-light, base16-atelier-estuary, base16-atelier-forest-light, base16-atelier-forest, base16-atelier-heath-light, base16-atelier-heath, base16-atelier-lakeside-light, base16-atelier-lakeside, base16-atelier-plateau-light, base16-atelier-plateau, base16-atelier-savanna-light, base16-atelier-savanna, base16-atelier-seaside-light, base16-atelier-seaside, base16-atelier-sulphurpool-light, base16-atelier-sulphurpool, base16-atlas, base16-bespin, base16-black-metal-bathory, base16-black-metal-burzum, base16-black-metal-dark-funeral, base16-black-metal-gorgoroth, base16-black-metal-immortal, base16-black-metal-khold, base16-black-metal-marduk, base16-black-metal-mayhem, base16-black-metal-nile, base16-black-metal-venom, base16-black-metal, base16-brewer, base16-bright, base16-brogrammer, base16-brush-trees-dark, base16-brush-trees, base16-chalk, base16-circus, base16-classic-dark, base16-classic-light, base16-codeschool, base16-colors, base16-cupcake, base16-cupertino, base16-danqing, base16-darcula, base16-dark-violet, base16-darkmoss, base16-darktooth, base16-decaf, base16-default-dark, base16-default-light, base16-dirtysea, base16-dracula, base16-edge-dark, base16-edge-light, base16-eighties, base16-embers, base16-equilibrium-dark, base16-equilibrium-gray-dark, base16-equilibrium-gray-light, base16-equilibrium-light, base16-espresso, base16-eva-dim, base16-eva, base16-flat, base16-framer, base16-fruit-soda, base16-gigavolt, base16-github, base16-google-dark, base16-google-light, base16-grayscale-dark, base16-grayscale-light, base16-green-screen, base16-gruvbox-dark-hard, base16-gruvbox-dark-medium, base16-gruvbox-dark-pale, base16-gruvbox-dark-soft, base16-gruvbox-light-hard, base16-gruvbox-light-medium, base16-gruvbox-light-soft, base16-hardcore, base16-harmonic16-dark, base16-harmonic16-light, base16-heetch-dark, base16-heetch-light, base16-helios, base16-hopscotch, base16-horizon-dark, base16-horizon-light, base16-humanoid-dark, base16-humanoid-light, base16-ia-dark, base16-ia-light, base16-icy-dark, base16-ir-black, base16-isotope, base16-kimber, base16-london-tube, base16-macintosh, base16-marrakesh, base16-materia, base16-material-darker, base16-material-lighter, base16-material-palenight, base16-material-vivid, base16-material, base16-mellow-purple, base16-mexico-light, base16-mocha, base16-monokai, base16-nebula, base16-nord, base16-nova, base16-ocean, base16-oceanicnext, base16-one-light, base16-onedark, base16-outrun-dark, base16-papercolor-dark, base16-papercolor-light, base16-paraiso, base16-pasque, base16-phd, base16-pico, base16-pop, base16-porple, base16-qualia, base16-railscasts, base16-rebecca, base16-ros-pine-dawn, base16-ros-pine-moon, base16-ros-pine, base16-sagelight, base16-sandcastle, base16-seti-ui, base16-shapeshifter, base16-silk-dark, base16-silk-light, base16-snazzy, base16-solar-flare-light, base16-solar-flare, base16-solarized-dark, base16-solarized-light, base16-spacemacs, base16-summercamp, base16-summerfruit-dark, base16-summerfruit-light, base16-synth-midnight-terminal-dark, base16-synth-midnight-terminal-light, base16-tango, base16-tender, base16-tomorrow-night, base16-tomorrow, base16-twilight, base16-unikitty-dark, base16-unikitty-light, base16-vulcan, base16-windows-10-light, base16-windows-10, base16-windows-95-light, base16-windows-95, base16-windows-high-contrast-light, base16-windows-high-contrast, base16-windows-nt-light, base16-windows-nt, base16-woodland, base16-xcode-dusk, base16-zenburn, brown-paper, codepen-embed, color-brewer, dark, default, devibeans, docco, far, felipec, foundation, github-dark-dimmed, github-dark, github, gml, googlecode, gradient-dark, gradient-light, grayscale, hybrid, idea, intellij-light, ir-black, isbl-editor-dark, isbl-editor-light, kimbie-dark, kimbie-light, lightfair, lioshi, magula, mono-blue, monokai-sublime, monokai, night-owl, nnfx-dark, nnfx-light, nord, obsidian, panda-syntax-dark, panda-syntax-light, paraiso-dark, paraiso-light, pojoaque, purebasic, qtcreator-dark, qtcreator-light, rainbow, routeros, school-book, shades-of-purple, srcery, stackoverflow-dark, stackoverflow-light, sunburst, tokyo-night-dark, tokyo-night-light, tomorrow-night-blue, tomorrow-night-bright, vs, vs2015, xcode, xt256]
              - additionalProperties: false
                properties:
                  prism:
                    additionalProperties: false
                    properties:
                      version:
                        oneOf:
                          - type: integer
                          - type: string
                            pattern: \d+\.\d+(\.\d+)?
                      style:
                        enum: [default, coy, dark, funky, okaidia, solarizedlight, tomorrow, twilight]
              - additionalProperties: false
                properties:
                  pygments:
                    additionalProperties: false
                    properties:
                      style:
                        enum: [abap, algol_nu, algol, arduino, autumn, borland, bw, colorful, default, dracula, emacs, friendly_grayscale, friendly, fruity, github-dark, gruvbox-dark, gruvbox-light, igor, inkpot, lightbulb, lilypond, lovelace, manni, material, monokai, murphy, native, nord-darker, nord, one-dark, paraiso-dark, paraiso-light, pastie, perldoc, rainbow_dash, rrt, sas, solarized-dark, solarized-light, staroffice, stata-dark, stata-light, stata, tango, trac, vim, vs, xcode, zenburn]
                      pre_class:
                        type: [string. null]
                      code_class:
                        type: [string, null]


      latex:
        additionalProperties: false
        properties:
          header: { type: string }
          theme: { type: string }
          processor: { type: string }
          toc: { type: boolean }
          paths: { type: object }
          headers_transform:
            properties:
              by_class:
                additionalProperties: false
                patternProperties:
                  .+: { type: string }
              by_global_level:
                additionalProperties: false
                patternProperties:
                  '^[1-9]\d*$': { type: string }
              by_page_level:
                additionalProperties: false
                patternProperties:
                  '^[1-9]\d*$': { type: string }
              by_element:
                additionalProperties: false
                patternProperties:
                  '^h\d*$': { type: string }

      pdf:
        additionalProperties: false
        properties:
          theme:
            oneOf:
              - enum: [raw, sobiraka2025]

              - type: string
                not: { enum: [raw, sobiraka2025] }

              - type: object
                additionalProperties: false
                properties:
                  name: { const: sobiraka2025 }
                  flavor: { enum: [green] }
                  customization: { type: string }
                required:
                  - name

              - type: object
                additionalProperties: false
                properties:
                  name:
                    oneOf:
                      - enum: [raw]
                      - type: string
                        not: { enum: [raw, sobiraka2025] }
                  flavor: { type: string }
                  customization: { type: string }
                required:
                  - name

          processor: { type: string }
          custom_styles:
            type: array
            uniqueItems: true
            items: { type: string }
          toc_depth:
            oneOf:
              - type: integer
              - enum: [infinity]
          combined_toc: { type: boolean }
          headers_policy:
            enum: [local, global]
          highlight:
            oneOf:
              - enum: [pygments]
              - additionalProperties: false
                properties:
                  pygments:
                    additionalProperties: false
                    properties:
                      style:
                        enum: [abap, algol_nu, algol, arduino, autumn, borland, bw, colorful, default, dracula, emacs, friendly_grayscale, friendly, fruity, github-dark, gruvbox-dark, gruvbox-light, igor, inkpot, lightbulb, lilypond, lovelace, manni, material, monokai, murphy, native, nord-darker, nord, one-dark, paraiso-dark, paraiso-light, pastie, perldoc, rainbow_dash, rrt, sas, solarized-dark, solarized-light, staroffice, stata-dark, stata-light, stata, tango, trac, vim, vs, xcode, zenburn]
                      pre_class:
                        type: [string. null]
                      code_class:
                        type: [string, null]

      prover:
        additionalProperties: false
        properties:
          dictionaries:
            type: array
            minItems: 0
            uniqueItems: true
            items:
              oneOf:
                - enum: [english, russian]
                - type: string
                  pattern: ^(?!english|russian$).*$
          skip_elements:
            type: array
            uniqueItems: true
            items:
              enum: [BlockQuote, BulletList, Caption, Citation, Cite, Code, CodeBlock, Definition, DefinitionItem, DefinitionList, Div, Doc, Emph, Header, HorizontalRule, Image, LineBlock, LineBreak, LineItem, Link, ListContainer, ListItem, Math, Note, Null, OrderedList, Para, Plain, Quoted, RawBlock, RawInline, SmallCaps, SoftBreak, Space, Span, Str, Strikeout, Strong, Subscript, Superscript, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Underline]
          phrases_must_begin_with_capitals: { type: boolean }
          allowed_quotation_marks:
            type: array
            uniqueItems: true
            items:
              type: array
              uniqueItems: true
              items:
                enum:
                  - Angled
                  - CurvedDouble
                  - CurvedSingle
                  - German
                  - StraightDouble
                  - StraightSingle
          allowed_apostrophes:
            type: array
            uniqueItems: true
            items:
              enum:
                - Curved
                - Straight

      variables:
        type: object
