{
	"type": "object",
	"description": "AIO containers definition schema",
	"minProperties": 1,
	"required": ["aio_services_v1"],
	"properties": {
		"aio_services_v1": {
			"type": "array",
			"items": {
				"type": "object",
				"additionalProperties": false,
				"minProperties": 2,
				"required": ["image", "container_name", "image_tag"],
				"properties": {
					"image": {
						"type": "string",
						"minLength": 1,
						"pattern": "^(ghcr.io/)?[a-z0-9/-]+$"
					},
					"expose": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^([0-9]{1,5})$"
						}
					},
					"cap_add": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^[A-Z_]+$"
						}
					},
					"cap_drop": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^[A-Z_]+$"
						}
					},
					"depends_on": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^nextcloud-aio-[a-z-]+$"
						}
					},
					"display_name": {
						"type": "string",
						"pattern": "^[A-Za-z 0-9-]+$"
					},
					"environment": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^.*=.*$",
							"minlength": 1
						}
					},
					"container_name": {
						"type": "string",
						"pattern": "^nextcloud-aio-[a-z0-9-]+$"
					},
					"internal_port": {
						"type": "string",
						"pattern": "^(([0-9]{1,5})|host|(%[A-Z_]+%))$"
					},
					"stop_grace_period": {
						"type": "integer"
					},
					"user": {
						"type": "string",
						"pattern": "^[0-9]{1,6}$"
					},
					"ports": {
						"type": "array",
						"items": {
							"type": "object",
							"additionalProperties": false,
							"minProperties": 3,
							"properties": {
								"ip_binding": {
									"type": "string",
									"pattern": "^(%[A-Z_]+%)?$"
								},
								"port_number": {
									"type": "string",
									"pattern": "^(%[A-Z_]+%|[0-9]{1,5})$"
								},
								"protocol": {
									"type": "string",
									"pattern": "^(tcp|udp)$"
								}
							}
						}
					},
					"healthcheck": {
						"type": "object",
						"additionalProperties": false,
						"minProperties": 6,
						"properties": {
							"interval": {
								"type": "string",
								"pattern": "^[0-9]+s$"
							},
							"timeout": {
								"type": "string",
								"pattern": "^[0-9]+s$"
							},
							"retries": {
								"type": "integer"
							},
							"start_period": {
								"type": "string",
								"pattern": "^[0-9]+s$"
							},
							"start_interval": {
								"type": "string",
								"pattern": "^[0-9]+s$"
							},
							"test": {
								"type": "string",
								"pattern": "^.*$"
							}
						}
					},
					"aio_variables": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^[A-Z_a-z-]+=.*$"
						}
					},
					"restart": {
						"type": "string",
						"pattern": "^unless-stopped$"
					},
					"shm_size": {
						"type": "integer"
					},
					"secrets": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^[A-Z_]+$"
						}
					},
					"ui_secret": {
						"type": "string",
						"pattern": "^[A-Z_]+$"
					},
					"image_tag": {
						"type": "string",
						"pattern": "^([a-z0-9.-]+|%AIO_CHANNEL%)$"
					},
					"documentation": {
						"type": "string",
						"pattern": "^https://.*$"
					},
					"devices": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^/dev/[a-z]+$"
						}
					},
					"enable_nvidia_gpu": {
						"type": "boolean"
					},
					"apparmor_unconfined": {
						"type": "boolean"
					},
					"backup_volumes": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^nextcloud_aio_[a-z_]+$"
						}
					},
					"nextcloud_exec_commands": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^(php /var/www/html/occ .*|echo .*|touch .*|mkdir .*)$"
						}
					},
					"profiles": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^[a-z-]+$"
						}
					},
					"read_only": {
						"type": "boolean"
					},
					"init": {
						"type": "boolean"
					},
					"tmpfs": {
						"type": "array",
						"items": {
							"type": "string",
							"pattern": "^/[a-z/_0-9-:]+$"
						}
					},
					"volumes": {
						"type": "array",
						"items": {
							"type": "object",
							"additionalProperties": false,
							"minProperties": 3,
							"properties": {
								"destination": {
									"type": "string",
									"pattern": "^((/[a-z_/.-]+)|(%[A-Z_]+%))$"
								},
								"source": {
									"type": "string",
									"pattern": "^((nextcloud_aio_[a-z_]+)|(%[A-Z_]+%)|(/dev)|(/run/udev))$"
								},
								"writeable": {
									"type": "boolean"
								}
							}
						}
					}
				}
			}
		}
	}
}