{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "https://luciozambon.altervista.org/app/panther_lattice.json",
	"title": "PAnTHer",
	"description": "Schema of the lattice file needed by PAnTHer",
	"type": "object",
	"patternProperties": {
		"^.*$": {
			"description": "identifier of a part of the accelerator, any unique string is valid",
			"type": "object",
			"properties": {
				"sections": {
					"description": "Stright sections only",
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"start": {
								"type": "object",
								"properties": {
									"x": {
										"type": "number"
									},
									"z": {
										"type": "number"
									}
								},
								"required": [
									"x",
									"z"
								]
							},
							"bending": {
								"type": "object",
								"properties": {
									"type": {
										"type": "string"
									},
									"length": {
										"type": "number"
									},
									"label": {
										"type": "string"
									},
									"lengthIndex": {
										"type": "number"
									},
									"name": {
										"type": "string"
									}
								}
							},
							"chamber": {
								"description": "Vacuum chamber towards the start position of the previous element of array (or towards the last element in the case of the first element)",
								"type": "object",
								"properties": {
									"type": {
										"type": "string"
									}
								},
								"required": [
									"type"
								]
							},
							"blm": {
								"description": "Beam Loss Monitors",
								"type": "object",
								"properties": {
									"confsrc": {
										"type": "string"
									},
									"datasrc": {
										"type": "string"
									},
									"skip": {
										"type": "string"
									}
								},
								"required": [
									"confsrc",
									"datasrc"
								]
							},
							"bpm": {
								"description": "Beam Position Monitors",
								"type": "object",
								"properties": {
									"pos": {
										"type": "string"
									},
									"rms": {
										"type": "string"
									},
									"length": {
										"type": "integer"
									},
									"offset": {
										"type": "integer"
									},
									"skip": {
										"type": "array",
										"items": {
											"type": "string"
										}
									}
								},
								"required": [
									"pos",
									"length",
									"offset"
								]
							},
							"envelope": {
								"description": "Beam Statistical envelope",
								"type": "object",
								"properties": {
									"src": {
										"type": "string"
									},
									"length": {
										"type": "array",
										"items": {
											"type": "number"
										}
									}
								},
								"required": [
									"src",
									"length"
								]
							},
							"components": {
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"type": {
											"type": "string"
										},
										"position": {
											"type": "number",
											"description": "distance in millimeters from the start position"
										},
										"name": {
											"type": "string"
										},
										"alias": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"labelReverse": {
											"type": ["boolean", "array"],
											"items": {"type": "number","description":"angle, offsetX, offsetZ"}
										},
										"embedded": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"type",
										"position",
										"name"
									]
								}
							}
						}
					}
				}
			}
		},
		"servicearea": {
			"description": "racks in service areas",
			"type": "object",
			"properties": {
				"sections": {
					"description": "Stright sections only",
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"start": {
								"type": "object",
								"properties": {
									"x": {
										"type": "number"
									},
									"y": {
										"type": "number"
									},
									"z": {
										"type": "number"
									}
								},
								"required": [
									"x",
									"z"
								]
							},
							"components": {
								"description": "racks or other objects",
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"type": {
											"type": "string"
										},
										"position": {
											"type": "number",
											"description": "distance in millimeters from the start position"
										},
										"name": {
											"type": "string"
										},
										"size": {
											"type": "object",
											"properties": {
												"dx": {
													"type": "number"
												},
												"dy": {
													"type": "number"
												},
												"dz": {
													"type": "number"
												}
											}
										},
										"embedded": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"type",
										"position",
										"name"
									]
								}
							}
						}
					}
				}
			}
		},
		"conf": {
			"description": "index for fast links",
			"type": "object",
			"properties": {
				"index": {
					"description": "index for fast links",
					"type": "object"
				}
			}
		}
	}
}