{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "DocuBook Configuration",
  "description": "Configuration schema for docu.json used by @docubook/flame",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "meta": {
      "type": "object",
      "description": "Site metadata",
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "description": "Site title" },
        "description": { "type": "string", "description": "Site description" },
        "baseURL": { "type": "string", "description": "Base URL for the site" },
        "favicon": { "type": "string", "description": "Path to favicon" },
        "ogImage": {
          "type": "string",
          "description": "Default OG image path (e.g. /docs/assets/images/og.png)"
        }
      },
      "required": ["title"]
    },
    "home": {
      "type": "object",
      "description": "Home page configuration",
      "additionalProperties": false,
      "properties": {
        "hero": { "$ref": "#/$defs/hero" },
        "features": {
          "type": "array",
          "description": "Feature cards displayed on home page",
          "items": { "$ref": "#/$defs/homeFeature" }
        }
      }
    },
    "navbar": {
      "type": "object",
      "description": "Navigation bar configuration",
      "additionalProperties": false,
      "properties": {
        "logo": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "src": { "type": "string", "description": "Logo image path" },
            "alt": { "type": "string", "description": "Logo alt text" }
          }
        },
        "logoText": { "type": "string", "description": "Text displayed next to logo" },
        "menu": {
          "type": "array",
          "description": "Top navigation menu items",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "title": { "type": "string" },
              "href": { "type": "string" }
            },
            "required": ["title", "href"]
          }
        }
      }
    },
    "footer": {
      "type": "object",
      "description": "Footer configuration",
      "additionalProperties": false,
      "properties": {
        "social": {
          "type": "array",
          "description": "Social media links",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "description": "Social platform name",
                "enum": [
                  "github",
                  "gitlab",
                  "bitbucket",
                  "npm",
                  "youtube",
                  "twitter",
                  "x",
                  "instagram",
                  "linkedin",
                  "facebook",
                  "telegram",
                  "discord",
                  "threads",
                  "mastodon"
                ]
              },
              "url": { "type": "string", "format": "uri" }
            },
            "required": ["name", "url"]
          }
        }
      }
    },
    "repo": {
      "type": "object",
      "description": "Repository configuration for edit links",
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Repository base URL. Supported platforms: GitHub, GitLab, Bitbucket, Gitea (gitea.com), Codeberg (codeberg.org), Gogs, Forgejo, or any self-hosted Gitea-compatible forge.",
          "examples": [
            "https://github.com/owner/repo",
            "https://gitlab.com/owner/repo",
            "https://bitbucket.org/owner/repo",
            "https://gitea.com/owner/repo",
            "https://codeberg.org/owner/repo"
          ]
        },
        "path": {
          "type": "string",
          "description": "Path template for edit links. Must contain {filePath} as a placeholder. Format: {platform-path}/{optional-subdir}/{filePath}. Leave empty to auto-detect from repo.url hostname.",
          "pattern": "\\{filePath\\}",
          "examples": [
            "blob/main/{filePath}",
            "blob/main/apps/web/{filePath}",
            "blob/develop/{filePath}",
            "-/blob/main/{filePath}",
            "-/blob/main/docs/{filePath}",
            "src/main/{filePath}",
            "src/branch/main/{filePath}",
            "src/branch/main/docs/{filePath}"
          ]
        },
        "edit": { "type": "boolean", "description": "Enable edit link on pages" }
      }
    },
    "sidebar": {
      "type": "object",
      "description": "Sidebar configuration",
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string",
          "enum": ["dropdown", "separator"],
          "default": "dropdown",
          "description": "How context sections are displayed in sidebar — dropdown (switcher) or separator (inline group headers)"
        }
      }
    },
    "routes": {
      "type": "array",
      "description": "Documentation navigation routes. Leave empty for auto-detection from docs/ folder.",
      "items": { "$ref": "#/$defs/route" }
    },
    "plugins": {
      "type": "array",
      "description": "List of DocuBook plugins to load",
      "items": {
        "oneOf": [
          {
            "type": "string",
            "description": "Plugin package name or relative path (e.g. @docubook/plugin-sitemap)"
          },
          {
            "type": "array",
            "description": "Plugin package name with factory options",
            "items": [
              {
                "type": "string",
                "description": "Plugin package name"
              },
              {
                "type": "object",
                "description": "Plugin factory options"
              }
            ],
            "minItems": 2,
            "maxItems": 2
          }
        ]
      }
    },
    "themes": {
      "type": "object",
      "description": "Color themes configuration. Use preset name or custom hex values.",
      "additionalProperties": false,
      "properties": {
        "colors": {
          "description": "Theme colors — preset name (e.g. \"default\", \"freshlime\", \"coffee\") or custom hex object",
          "oneOf": [
            {
              "type": "string",
              "enum": ["default", "freshlime", "coffee"]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "primary": {
                  "type": "string",
                  "pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
                  "description": "Primary brand color in hex format"
                }
              },
              "required": ["primary"]
            }
          ]
        }
      },
      "required": ["colors"]
    }
  },
  "$defs": {
    "route": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "description": "Display title" },
        "href": { "type": "string", "description": "URL path" },
        "noLink": {
          "type": "boolean",
          "description": "If true, title is not clickable (section header only)"
        },
        "context": {
          "type": "object",
          "description": "Context metadata for sidebar section",
          "additionalProperties": false,
          "properties": {
            "icon": { "type": "string", "description": "Lucide icon name" },
            "title": { "type": "string", "description": "Context switcher title" },
            "description": { "type": "string", "description": "Context switcher description" }
          }
        },
        "items": {
          "type": "array",
          "description": "Child routes",
          "items": { "$ref": "#/$defs/route" }
        }
      },
      "required": ["title", "href"]
    },
    "hero": {
      "type": "object",
      "description": "Hero section configuration for home page",
      "additionalProperties": false,
      "properties": {
        "tagline": {
          "type": "string",
          "description": "Tagline displayed above the headline (e.g., product name)"
        },
        "headline": { "type": "string", "description": "Main heading text" },
        "description": {
          "type": "string",
          "description": "Description text displayed below the headline"
        },
        "actions": {
          "type": "array",
          "description": "Action buttons displayed in the hero section",
          "items": { "$ref": "#/$defs/heroAction" }
        }
      },
      "required": ["headline"]
    },
    "heroAction": {
      "type": "object",
      "description": "Action button in hero section",
      "additionalProperties": false,
      "properties": {
        "text": { "type": "string", "description": "Button label" },
        "link": { "type": "string", "description": "Button link URL" },
        "theme": {
          "type": "string",
          "description": "Button color theme",
          "enum": ["primary", "secondary", "ghost"]
        },
        "icon": { "type": "string", "description": "Lucide icon name" }
      },
      "required": ["text", "link"]
    },
    "homeFeature": {
      "type": "object",
      "description": "Feature card for home page",
      "additionalProperties": false,
      "properties": {
        "icon": { "type": "string", "description": "Lucide icon name" },
        "title": { "type": "string", "description": "Feature title" },
        "description": { "type": "string", "description": "Feature description" },
        "link": { "type": "string", "description": "Feature link URL" }
      },
      "required": ["title", "description"]
    }
  }
}
