{
  "type": "object",
  "keys": {
    "folders": {
      "type": "string",
      "flags": {
        "only": true,
        "presence": "optional"
      },
      "allow": [
        "expanded",
        "collapsed"
      ]
    },
    "default": {
      "type": "object",
      "flags": {
        "description": "defaults for new team visualizations"
      },
      "keys": {
        "folder": {
          "type": "number",
          "allow": [
            null
          ]
        },
        "locale": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "flags": {
            "presence": "optional",
            "description": "default visualization metadata to be applied to all new visualizations"
          }
        }
      }
    },
    "locales": {
      "type": "object",
      "keys": {
        "numeral": {
          "type": "object",
          "keys": {}
        }
      }
    },
    "controls": {
      "type": "object",
      "flags": {
        "description": "special configuration options for chart controls"
      },
      "keys": {
        "customFormats": {
          "type": "object",
          "flags": {
            "description": "User-defined custom formats that will be displayed by the customFormat control, instead of our defaults"
          },
          "keys": {
            "date": {
              "type": "array",
              "items": [
                {
                  "type": "object",
                  "keys": {
                    "value": {
                      "type": "string",
                      "flags": {
                        "description": "The custom date/number format string"
                      }
                    },
                    "label": {
                      "type": "string",
                      "flags": {
                        "description": "The label for custom format in the UI"
                      }
                    }
                  }
                }
              ]
            },
            "number": {
              "type": "array",
              "items": [
                {
                  "type": "object",
                  "keys": {
                    "value": {
                      "type": "string",
                      "flags": {
                        "description": "The custom date/number format string"
                      }
                    },
                    "label": {
                      "type": "string",
                      "flags": {
                        "description": "The label for custom format in the UI"
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "embed": {
      "type": "object",
      "flags": {
        "description": "defaults for new team visualizations"
      },
      "keys": {
        "preferred_embed": {
          "type": "string",
          "flags": {
            "only": true,
            "presence": "optional"
          },
          "allow": [
            "responsive",
            "iframe",
            "custom"
          ]
        },
        "custom_embed": {
          "type": "object",
          "flags": {
            "description": "custom embed code for team",
            "presence": "optional"
          },
          "keys": {
            "title": {
              "type": "string"
            },
            "text": {
              "type": "string"
            },
            "template": {
              "type": "string"
            }
          }
        }
      }
    },
    "customFields": {
      "type": "array",
      "flags": {
        "presence": "optional"
      },
      "items": [
        {
          "type": "object",
          "keys": {
            "title": {
              "type": "string"
            },
            "description": {
              "type": "string",
              "allow": [
                ""
              ]
            },
            "key": {
              "type": "string"
            },
            "type": {
              "type": "string"
            }
          }
        }
      ]
    },
    "ftp": {
      "type": "object",
      "flags": {
        "description": "ftp upload settings",
        "presence": "optional"
      },
      "keys": {
        "enabled": {
          "type": "boolean"
        },
        "server": {
          "type": "string",
          "allow": [
            ""
          ]
        },
        "user": {
          "type": "string",
          "allow": [
            ""
          ]
        },
        "password": {
          "type": "string",
          "allow": [
            ""
          ]
        },
        "directory": {
          "type": "string",
          "allow": [
            ""
          ]
        },
        "filename": {
          "type": "string",
          "allow": [
            ""
          ]
        }
      }
    },
    "disableVisualizations": {
      "type": "object",
      "flags": {
        "description": "restrict chart types for team",
        "presence": "optional"
      },
      "keys": {
        "enabled": {
          "type": "boolean"
        },
        "allowAdmins": {
          "type": "boolean"
        },
        "visualizations": {
          "type": "any"
        }
      }
    },
    "restrictDefaultThemes": {
      "type": "boolean"
    },
    "publishTarget": {
      "type": "object",
      "keys": {
        "hostname": {
          "type": "string",
          "flags": {
            "description": "the hostname the published charts will be reached under, e.g. datawrapper.dwcdn.net",
            "presence": "required"
          }
        },
        "protocol": {
          "type": "string",
          "flags": {
            "only": true,
            "default": "https"
          },
          "allow": [
            "http",
            "https"
          ]
        },
        "provider": {
          "type": "string",
          "flags": {
            "only": true,
            "presence": "required",
            "description": "the storage provider id"
          },
          "allow": [
            "s3",
            "gcs",
            false
          ]
        },
        "serve_assets": {
          "type": "boolean",
          "flags": {
            "description": "set to true if chart assets should be served from the chart host as well",
            "default": false
          }
        },
        "disable_redirects": {
          "type": "boolean",
          "flags": {
            "description": "set to true if previously published visualization embeds should not redirect to the most recent version",
            "default": false
          }
        },
        "config": {
          "type": "any",
          "whens": [
            {
              "ref": {
                "path": [
                  "provider"
                ]
              },
              "is": {
                "type": "any",
                "flags": {
                  "only": true,
                  "presence": "required"
                },
                "allow": [
                  {
                    "override": true
                  },
                  "s3"
                ]
              },
              "then": {
                "type": "object",
                "flags": {
                  "presence": "required"
                },
                "keys": {
                  "accesskey": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "secretkey": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "bucket": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "region": {
                    "type": "string"
                  },
                  "endpoint": {
                    "type": "string"
                  }
                }
              }
            },
            {
              "ref": {
                "path": [
                  "provider"
                ]
              },
              "is": {
                "type": "any",
                "flags": {
                  "only": true,
                  "presence": "required"
                },
                "allow": [
                  {
                    "override": true
                  },
                  "gcs"
                ]
              },
              "then": {
                "type": "object",
                "flags": {
                  "presence": "required"
                },
                "keys": {
                  "project_id": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "client_id": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "client_email": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "private_key_id": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "private_key": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "bucket": {
                    "type": "string",
                    "flags": {
                      "presence": "required"
                    }
                  },
                  "auth_uri": {
                    "type": "string"
                  },
                  "token_uri": {
                    "type": "string"
                  },
                  "auth_provider_x509_cert_url": {
                    "type": "string"
                  },
                  "client_x509_cert_url": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                }
              }
            }
          ]
        }
      }
    },
    "css": {
      "type": "string",
      "flags": {
        "presence": "optional"
      }
    },
    "pdfUpload": {
      "type": "object",
      "flags": {
        "presence": "optional"
      },
      "keys": {
        "ftp": {
          "type": "object",
          "flags": {
            "presence": "optional"
          },
          "keys": {
            "enabled": {
              "type": "boolean"
            },
            "server": {
              "type": "string"
            },
            "user": {
              "type": "string"
            },
            "password": {
              "type": "string"
            },
            "directory": {
              "type": "string",
              "allow": [
                ""
              ]
            },
            "filename": {
              "type": "string"
            }
          }
        },
        "s3": {
          "type": "object",
          "flags": {
            "presence": "optional"
          },
          "keys": {
            "enabled": {
              "type": "boolean"
            },
            "bucket": {
              "type": "string"
            },
            "region": {
              "type": "string"
            },
            "accessKeyId": {
              "type": "string"
            },
            "secret": {
              "type": "string"
            },
            "prefix": {
              "type": "string",
              "allow": [
                ""
              ]
            },
            "filename": {
              "type": "string"
            }
          }
        }
      }
    },
    "flags": {
      "type": "object",
      "flags": {
        "presence": "optional"
      },
      "keys": {
        "output_locale": {
          "type": "boolean",
          "flags": {
            "default": true
          }
        },
        "social_sharing": {
          "type": "boolean",
          "flags": {
            "default": true
          }
        },
        "byline": {
          "type": "boolean",
          "flags": {
            "default": true
          }
        }
      }
    },
    "webhook_url": {
      "type": "string",
      "flags": {
        "presence": "optional"
      },
      "rules": [
        {
          "name": "uri"
        }
      ]
    },
    "msteams_webhook_url": {
      "type": "string",
      "flags": {
        "presence": "optional"
      },
      "rules": [
        {
          "name": "uri"
        }
      ]
    },
    "slack_webhook_url": {
      "type": "string",
      "flags": {
        "presence": "optional"
      },
      "rules": [
        {
          "name": "uri"
        }
      ]
    },
    "publishFormats": {
      "type": "array",
      "flags": {
        "presence": "optional"
      },
      "items": [
        {
          "type": "object",
          "keys": {
            "plain": {
              "type": "boolean"
            },
            "width": {
              "type": "number",
              "rules": [
                {
                  "name": "min",
                  "args": {
                    "limit": 1
                  }
                }
              ]
            },
            "height": {
              "type": "alternatives",
              "matches": [
                {
                  "schema": {
                    "type": "number",
                    "rules": [
                      {
                        "name": "min",
                        "args": {
                          "limit": 1
                        }
                      }
                    ]
                  }
                },
                {
                  "schema": {
                    "type": "string",
                    "flags": {
                      "only": true
                    },
                    "allow": [
                      "auto"
                    ]
                  }
                }
              ]
            },
            "format": {
              "type": "string",
              "flags": {
                "only": true
              },
              "allow": [
                "png",
                "pdf",
                "svg"
              ]
            },
            "filename": {
              "type": "string"
            },
            "logo": {
              "type": "string",
              "flags": {
                "only": true
              },
              "allow": [
                "on",
                "off",
                "auto"
              ]
            },
            "ligatures": {
              "type": "boolean"
            },
            "zoom": {
              "type": "number",
              "flags": {
                "description": "scale factor, for PNG images"
              },
              "rules": [
                {
                  "name": "min",
                  "args": {
                    "limit": 1
                  }
                }
              ]
            },
            "scale": {
              "type": "number",
              "flags": {
                "description": "scale factor, for PDF files"
              }
            },
            "borderWidth": {
              "type": "number",
              "flags": {
                "description": "outer padding, for PNG images"
              },
              "rules": [
                {
                  "name": "min",
                  "args": {
                    "limit": 0
                  }
                }
              ]
            },
            "transparent": {
              "type": "boolean",
              "flags": {
                "description": "determines if PNG background will be transparent or opaque"
              }
            },
            "colorMode": {
              "type": "boolean",
              "flags": {
                "only": true,
                "description": "Color mode, for PDF"
              },
              "allow": [
                "cmyk",
                "rgb"
              ]
            },
            "units": {
              "type": "string",
              "flags": {
                "only": true,
                "description": "Unit of chosen dimensions, for PDF"
              },
              "allow": [
                "mm",
                "in",
                "px"
              ]
            }
          }
        }
      ]
    },
    "waitForImagesDuringPublish": {
      "type": "boolean",
      "flags": {
        "default": false
      }
    },
    "showEditorNavInCmsMode": {
      "type": "boolean",
      "flags": {
        "description": "When Datawrapper is opened inside an iframe as part of a CMS integration, we hide the editor step navigation unless this setting is set to true.",
        "default": false
      }
    },
    "previewWidths": {
      "type": "array",
      "flags": {
        "description": "Set custom preview \"breakpoints\" which are used in the editor toolbar to preview charts on mobile, tablet and desktop widths."
      },
      "rules": [
        {
          "name": "length",
          "args": {
            "limit": 3
          }
        }
      ],
      "items": [
        {
          "type": "number",
          "rules": [
            {
              "name": "integer"
            },
            {
              "name": "min",
              "args": {
                "limit": 1
              }
            }
          ],
          "allow": [
            null
          ]
        }
      ]
    },
    "basemaps": {
      "type": "object",
      "flags": {
        "description": "basemap settings for choropleth and symbol maps",
        "presence": "optional"
      },
      "keys": {
        "hidden": {
          "type": "array",
          "flags": {
            "presence": "optional"
          },
          "items": [
            {
              "type": "string"
            }
          ]
        }
      }
    }
  }
}