{
	"$id": "custom-field.json",
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"type": "object",
	"required": ["handle", "label", "type"],
	"unevaluatedProperties": false,
	"properties": {
		"handle": {
			"type": "string",
			"pattern": "^[a-z]{1}[a-zA-Z0-9]+$"
		},
		"label": {
			"type": "string"
		},
		"description": {
			"type": "string"
		},
		"type": {
			"enum": ["text", "email", "url", "date", "time", "duration", "boolean", "integer", "number", "option", "options"]
		},
		"required": {
			"type": "boolean"
		},
		"meta": {
			"type": "object"
		}
	},
	"allOf": [
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["text", "email", "url"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min-ength": {
								"type": "number"
							},
							"max-length": {
								"type": "number"
							},
							"pattern": {
								"type": "string",
								"format": "regex"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["date"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min": {
								"type": "string",
								"format": "date"
							},
							"max": {
								"type": "string",
								"format": "date"
							},
							"step": {
								"type": "integer"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["time"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min": {
								"type": "string",
								"format": "time"
							},
							"max": {
								"type": "string",
								"format": "time"
							},
							"step": {
								"type": "integer"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["duration"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min": {
								"type": "string",
								"format": "duration"
							},
							"max": {
								"type": "string",
								"format": "duration"
							},
							"step": {
								"type": "integer"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["integer"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min": {
								"type": "integer"
							},
							"max": {
								"type": "integer"
							},
							"step": {
								"type": "integer"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["number"]
					}
				}
			},
			"then": {
				"properties": {
					"attributes": {
						"type": "object",
						"unevaluatedProperties": false,
						"properties": {
							"min": {
								"type": "number"
							},
							"max": {
								"type": "number"
							},
							"step": {
								"type": "number"
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"type": {
						"enum": ["option", "options"]
					}
				}
			},
			"then": {
				"properties": {
					"options": {
						"type": "array",
						"minItems": 1,
						"items": {
							"type": "string"
						}
					}
				}
			}
		}
	]
}