{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://splitleaf.eu/schema/collection.v1.json",
  "title": "Splitleaf content collection",
  "description": "content/<collection>/_collection.json, defines the structure of a content collection. The folder is the slug.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "icon": {
      "type": "string"
    },
    "parentFolder": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]*$"
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "referenceCollection": {
            "type": "string"
          },
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "integer": {
            "type": "boolean"
          },
          "allowNegative": {
            "type": "boolean"
          },
          "minLength": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "maxLength": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "multiline": {
            "type": "boolean"
          },
          "defaultValue": {},
          "showWhen": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1
              },
              "op": {
                "type": "string",
                "enum": [
                  "eq",
                  "neq",
                  "lt",
                  "lte",
                  "gt",
                  "gte",
                  "set",
                  "not-set"
                ]
              },
              "equals": {
                "type": [
                  "string",
                  "boolean",
                  "number"
                ]
              }
            },
            "required": [
              "field"
            ],
            "additionalProperties": {}
          },
          "type": {
            "type": "string",
            "enum": [
              "title",
              "text",
              "content",
              "richtext",
              "boolean",
              "number",
              "date",
              "datetime",
              "select",
              "multiselect",
              "url",
              "slug",
              "image",
              "images",
              "color",
              "reference",
              "multireference",
              "list",
              "group"
            ]
          },
          "children": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "referenceCollection": {
                  "type": "string"
                },
                "min": {
                  "type": "number"
                },
                "max": {
                  "type": "number"
                },
                "integer": {
                  "type": "boolean"
                },
                "allowNegative": {
                  "type": "boolean"
                },
                "minLength": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "maxLength": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "multiline": {
                  "type": "boolean"
                },
                "defaultValue": {},
                "showWhen": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string",
                      "minLength": 1
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "neq",
                        "lt",
                        "lte",
                        "gt",
                        "gte",
                        "set",
                        "not-set"
                      ]
                    },
                    "equals": {
                      "type": [
                        "string",
                        "boolean",
                        "number"
                      ]
                    }
                  },
                  "required": [
                    "field"
                  ],
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "content",
                    "richtext",
                    "boolean",
                    "number",
                    "date",
                    "datetime",
                    "select",
                    "multiselect",
                    "url",
                    "image",
                    "images",
                    "color",
                    "reference",
                    "multireference",
                    "list"
                  ]
                }
              },
              "required": [
                "name",
                "type"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "name",
          "type"
        ],
        "additionalProperties": {}
      }
    }
  },
  "required": [
    "name",
    "fields"
  ],
  "additionalProperties": {}
}
