{
  "$schema": "http://json-schema.org/draft-07/schema",
  "definitions": {
    "email": { "type": "string", "format": "email", "default": "$email" },
    "per_page": { "type": "number", "minimum": 0, "default": 10 },
    "color": { "type": "string", "pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$", "default": "#2a2b33" },
    "request": {
      "type": "object",
      "properties": {
        "url": { "type": "string", "format": "uri", "minLength": 1 },
        "method": { "enum": ["post", "get", "POST", "GET"] },
        "body": { "type": "string" },
        "headers": {
          "type": "object",
          "additionalProperties": { "type": "string" }
        }
      },
      "additionalProperties": false,
      "required": ["url"]
    },
    "highlight": {
      "type": "array",
      "items": { "$ref": "#/definitions/color" },
      "minItems": 15
    }
  },
  "type": "object",
  "properties": {
    "appearance": {
      "type": "object",
      "properties": {
        "accent_color": { "$ref": "#/definitions/color" },
        "foreground_color": { "$ref": "#/definitions/color" },
        "border_color": { "$ref": "#/definitions/color" },
        "background": { "type": "string" },
        "sidebar_background": { "type": "string" },
        "card_background": { "type": "string" },
        "highlight": { "$ref": "#/definitions/highlight" },
        "content_width": {
          "oneOf": [
            { "type": "number" },
            { "type": "string" }
          ]
        },
        "font": {
          "type": "object",
          "properties": {
            "url": { "type": "string", "format": "uri" },
            "logo": { "type": "string" },
            "menu": { "type": "string" },
            "label": { "type": "string" },
            "heading": { "type": "string" },
            "code": { "type": "string" },
            "base": { "type": "string" },
            "print": { "type": "string" }
          },
          "additionalProperties": false
        },
        "darkmode": {
          "type": "object",
          "properties": {
            "accent_color": { "$ref": "#/definitions/color" },
            "foreground_color": { "$ref": "#/definitions/color" },
            "border_color": { "$ref": "#/definitions/color" },
            "background": { "type": "string" },
            "sidebar_background": { "type": "string" },
            "card_background": { "type": "string" },
            "highlight": { "$ref": "#/definitions/highlight" }
          },
          "additionalProperties": false
        }
      },
      "required": ["accent_color"],
      "additionalProperties": false
    },
    "profile": {
      "type": "object",
      "properties": {
        "email": { "$ref": "#/definitions/email" },
        "avatar": { "type": "string", "format": "uri", "default": "$gravatar" },
        "bio": { "type": "string" }
      },
      "additionalProperties": false,
      "required": ["email", "avatar"]
    },
    "menu": { "type": "object", "additionalProperties": { "type": "string" } },
    "sns": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "email": {
              "oneOf": [
                { "$ref": "#/definitions/email" },
                { "type": "null" }
              ]
            },
            "feed": {
              "oneOf": [
                { "type": "string", "format": "uri", "default": "$feed" },
                { "type": "null" }
              ]
            }
          },
          "patternProperties": {
            "^(github|twitter|facebook|instagram|tumblr|dribbble|telegram|youtube|hangouts|linkedin|pinterest|soundcloud|myspace|weibo|qq)$": { "type": "string" }
          }
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "icon": { "type": "string" },
              "title": { "type": "string" },
              "url": { "type": "string" },
              "template": { "type": "string" }
            },
            "additionalProperties": false
          }
        }
      ]
    },
    "footer": {
      "type": "object",
      "properties": {
        "copyright": {
          "oneOf":[
            { "type": "string", "contentMediaType": "text/html" },
            { "enum": [false] }
          ],
          "default": "$copyright"
        },
        "powered": { "type": "boolean", "default": true },
        "theme": { "type": "boolean", "default": true },
        "custom": { "type": "string" }
      },
      "required": ["copyright", "powered", "theme"],
      "additionalProperties": false
    },
    "assets": {
      "type": "object",
      "properties": {
        "prefix": { "type": "string" },
        "suffix": { "type": "string" }
      },
      "additionalProperties": false
    },
    "toc": {
      "type": "object",
      "properties": {
        "depth": { "type": "number", "minimum": 1, "maximum": 4, "default": 3 },
        "index": { "type": "boolean", "default": true }
      },
      "required": ["depth", "index"],
      "additionalProperties": false
    },
    "reward": {
      "type": "object",
      "properties": {
        "text": { "type": "string", "default": "Buy me a cup of coffee ☕." },
        "methods": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "text": { "type": "string" },
              "qrcode": { "type": "string" },
              "url": { "type": "string" },
              "color": { "$ref": "#/definitions/color" }
            },
            "required": ["name"],
            "minProperties": 2,
            "additionalProperties": false
          }
        }
      },
      "required": ["methods"],
      "additionalProperties": false
    },
    "copyright": {
      "type": "object",
      "properties": {
        "author": { "type": "boolean", "default": true },
        "link": { "type": "boolean", "default": true },
        "license": {
          "oneOf": [
            { "type": "string", "contentMediaType": "text/html" },
            { "enum": [false] }
          ],
          "default": "Attribution-NonCommercial-NoDerivatives 4.0 International (<a href=\"https://creativecommons.org/licenses/by-nc-sa/4.0/\" rel=\"external nofollow noopener\" target=\"_blank\">CC BY-NC-ND 4.0</a>)"
        },
        "published": { "type": "boolean" },
        "updated": { "type": "boolean" },
        "custom": { "type": "string" }
      },
      "required": ["author", "link", "license"],
      "additionalProperties": false
    },
    "comments": {
      "oneOf":[
        {
          "type": "object",
          "properties": {
            "disqus": {
              "type": "object",
              "properties": {
                "shortname": { "type": "string" },
                "script": { "type": "string", "format": "uri" },
                "autoload": { "type": "boolean", "default": true }
              },
              "required": ["shortname", "autoload"],
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "livere": {
              "type": "object",
              "properties": {
                "uid": { "type": "string" },
                "script": { "type": "string", "format": "uri", "default": "https://cdn-city.livere.com/js/embed.dist.js" },
                "autoload": { "type": "boolean", "default": true }
              },
              "required": ["uid", "script", "autoload"],
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "page": {
      "type": "object",
      "properties": {
        "toc": { "type": "boolean", "default": true },
        "reward": { "type": "boolean" },
        "copyright": { "type": "boolean" }
      },
      "required": ["toc"],
      "additionalProperties": false
    },
    "post": {
      "type": "object",
      "properties": {
        "per_page": { "$ref": "#/definitions/per_page" },
        "toc": { "type": "boolean", "default": true },
        "reward": { "type": "boolean" },
        "copyright": { "type": "boolean" },
        "reading_time": {
          "oneOf": [
            { "type": "boolean" },
            {
              "type": "object",
              "properties": {
                "wpm": { "type": "number", "default": 150 },
                "text": { "type": "string" }
              },
              "additionalProperties": false
            }
          ],
          "default": true
        }
      },
      "required": ["per_page", "toc", "reading_time"],
      "additionalProperties": false
    },
    "archive": {
      "type": "object",
      "properties": {
        "per_page": { "$ref": "#/definitions/per_page" }
      },
      "required": ["per_page"],
      "additionalProperties": false
    },
    "tag": {
      "type": "object",
      "properties": {
        "per_page": { "$ref": "#/definitions/per_page" }
      },
      "required": ["per_page"],
      "additionalProperties": false
    },
    "category": {
      "type": "object",
      "properties": {
        "per_page": { "$ref": "#/definitions/per_page" }
      },
      "required": ["per_page"],
      "additionalProperties": false
    },
    "search": {
      "type": "object",
      "properties": {
        "fab": { "enum": [true] },
        "page": { "enum": [true] },
        "adapter": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "range": { "type": "array", "items": { "enum": ["post", "page"] } },
                "per_page": { "$ref": "#/definitions/per_page" },
                "limit": { "type": "number", "default": 10000 }
              },
              "required": ["range", "per_page", "limit"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "per_page": { "$ref": "#/definitions/per_page" },
                "logo": { "type": "string" },
                "request": { "$ref": "#/definitions/request" },
                "keys": {
                  "type": "object",
                  "properties": {
                    "data": { "type": "string" },
                    "current": { "type": "string" },
                    "total": { "type": "string" },
                    "hits": { "type": "string" },
                    "time": { "type": "string" },
                    "title": { "type": "string" },
                    "content": { "type": "string" }
                  },
                  "required": ["data", "current"],
                  "additionalProperties": false
                }
              },
              "required": ["per_page", "request", "keys"],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": ["adapter"],
      "minProperties": 2,
      "additionalProperties": false
    },
    "static_prefix": { "type": "string" },
    "data_prefix": { "type": "string" },
    "data_dir": { "type": "string", "default": "api" },
    "favicon": { "type": "string", "default": "favicon.ico" },
    "ga": { "type": "string" },
    "seo": {
      "type": "object",
      "properties": {
        "structured_data": { "type": "boolean" },
        "ssr": { "type": "boolean" }
      },
      "additionalProperties": false,
      "default": {}
    },
    "plugins": {
      "definitions": {
        "position": {
          "enum": [
            "sidebar", "avatar", "post", "page", "comments", "head_begin", "head_end", "body_begin", "body_end"
          ]
        }
      },
      "type": "array",
      "items": {
        "oneOf": [
          { "type": "string" },
          {
            "type": "object",
            "properties": {
              "template": { "type": "string" },
              "position": {
                "oneOf": [
                  { "$ref": "#/properties/plugins/definitions/position" },
                  { "type": "array", "items": { "$ref": "#/properties/plugins/definitions/position" } }
                ]
              }
            },
            "required": ["template", "position"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "additionalProperties": true
          }
        ]
      },
      "default": []
    },
    "pwa": {
      "type": "object",
      "properties": {
        "workbox": {
          "definitions": {
            "expire": { "type": "number", "minimum": 0, "default": 4 }
          },
          "type": "object",
          "properties": {
            "cdn": { "type": "string", "format": "uri", "default": "https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js" },
            "module_path_prefix": { "type": "string" },
            "expire": { "$ref": "#/properties/pwa/properties/workbox/definitions/expire" },
            "name": { "type": "string", "pattern": "^\\w*\\.js$", "default": "sw.js" },
            "rules": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": { "type": "string" },
                  "strategy": { "enum": ["networkOnly", "cacheFirst", "cacheOnly", "staleWhileRevalidate"] },
                  "regex": { "type": "string", "format": "regex" },
                  "expire": { "$ref": "#/properties/pwa/properties/workbox/definitions/expire" }
                },
                "required": ["name", "strategy", "regex"],
                "additionalProperties": false
              }
            }
          },
          "required": ["cdn", "expire", "name", "rules"],
          "additionalProperties": false
        },
        "manifest": {
          "type": "object",
          "properties": {
            "name": { "type": "string", "default": "$title" },
            "short_name": { "type": "string", "default": "$title" },
            "description": { "type": "string", "default": "$description" },
            "start_url": { "type": "string", "format": "uri", "default": "." },
            "theme_color": { "$ref": "#/definitions/color" },
            "background_color": { "$ref": "#/definitions/color" },
            "icons": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "src": { "type": "string" },
                  "sizes": { "type": "string" },
                  "type": { "type": "string" },
                  "purpose": { "type": "string" }
                },
                "required": ["src", "sizes", "type"],
                "additionalProperties": false
              }
            },
            "display": { "enum": ["minimal-ui", "fullscreen", "standalone", "browser"], "default": "minimal-ui" }
          },
          "required": ["name", "short_name", "description", "start_url", "theme_color", "background_color", "icons", "display"],
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "default": {}
    },
    "markdown": {
      "type": "object",
      "properties": {
        "html": { "type": "boolean" },
        "xhtmlOut": { "type": "boolean" },
        "breaks": { "type": "boolean" },
        "linkify": { "type": "boolean" },
        "typographer": { "type": "boolean" },
        "quotes": { "type": "string" },
        "plugins": {
          "type": "array",
          "items": {
            "oneOf": [
              { "type": "string" },
              { "type": "object" }
            ]
          }
        }
      },
      "additionalProperties": false,
      "default": {}
    }
  },
  "required": ["appearance", "profile", "footer", "toc", "page", "post", "archive", "tag", "category", "data_dir", "favicon", "pwa", "seo", "markdown", "plugins"],
  "additionalProperties": false
}
