{
	"$id": "https://registry.atlas-cmdb.com/schema/atlas-extension.schema.json",
	"title": "Atlas extension manifest",
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"type": "object",
	"properties": {
		"id": {
			"type": "string",
			"minLength": 2,
			"maxLength": 48,
			"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
		},
		"name": {
			"type": "string",
			"minLength": 1,
			"maxLength": 80
		},
		"version": {
			"type": "string",
			"pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
		},
		"publisher": {
			"type": "string",
			"minLength": 2,
			"maxLength": 48,
			"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
		},
		"description": {
			"type": "string",
			"maxLength": 500
		},
		"icon": {
			"type": "string",
			"maxLength": 64
		},
		"homepage": {
			"type": "string",
			"format": "uri"
		},
		"atlasApi": {
			"type": "string",
			"minLength": 1,
			"maxLength": 40
		},
		"image": {
			"type": "string",
			"pattern": "^[a-z0-9][a-z0-9._\\-/:]*@sha256:[a-f0-9]{64}$"
		},
		"scopes": {
			"default": [],
			"maxItems": 50,
			"type": "array",
			"items": {
				"type": "string"
			}
		},
		"settings": {
			"default": [],
			"maxItems": 30,
			"type": "array",
			"items": {
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"pattern": "^[a-z][a-z0-9-]{0,63}$"
					},
					"label": {
						"type": "string",
						"minLength": 1,
						"maxLength": 80
					},
					"type": {
						"type": "string",
						"enum": [
							"text",
							"secret",
							"number",
							"boolean",
							"select",
							"category"
						]
					},
					"description": {
						"type": "string",
						"maxLength": 400
					},
					"required": {
						"type": "boolean"
					},
					"options": {
						"maxItems": 100,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"value": {
									"type": "string"
								},
								"label": {
									"type": "string"
								}
							},
							"required": [
								"value",
								"label"
							]
						}
					}
				},
				"required": [
					"name",
					"label",
					"type"
				]
			}
		},
		"storage": {
			"default": {
				"collections": {}
			},
			"type": "object",
			"properties": {
				"collections": {
					"default": {},
					"type": "object",
					"propertyNames": {
						"type": "string",
						"pattern": "^[a-z][a-z0-9_-]{0,63}$"
					},
					"additionalProperties": {
						"type": "object",
						"properties": {
							"indexes": {
								"maxItems": 5,
								"type": "array",
								"items": {
									"type": "string"
								}
							}
						}
					}
				}
			}
		},
		"functions": {
			"default": [],
			"maxItems": 50,
			"type": "array",
			"items": {
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"pattern": "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
					},
					"permission": {
						"type": "string",
						"enum": [
							"organization:view",
							"content:edit",
							"content:delete-request",
							"content:delete-review",
							"organization:manage"
						]
					}
				},
				"required": [
					"name"
				]
			}
		},
		"lifecycle": {
			"default": [],
			"maxItems": 3,
			"type": "array",
			"items": {
				"type": "string",
				"enum": [
					"install",
					"upgrade",
					"uninstall"
				]
			}
		},
		"contributes": {
			"default": {},
			"type": "object",
			"properties": {
				"navigation": {
					"maxItems": 10,
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"minLength": 2,
								"maxLength": 48,
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
							},
							"label": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"icon": {
								"type": "string",
								"maxLength": 64
							},
							"page": {
								"type": "string",
								"maxLength": 200,
								"pattern": "^([a-z0-9-]+|\\[[a-z_][a-z0-9_]*\\])(\\/([a-z0-9-]+|\\[[a-z_][a-z0-9_]*\\]))*$"
							},
							"order": {
								"type": "integer",
								"minimum": 0,
								"maximum": 1000
							},
							"permission": {
								"type": "string",
								"enum": [
									"organization:view",
									"content:edit",
									"content:delete-request",
									"content:delete-review",
									"organization:manage"
								]
							}
						},
						"required": [
							"id",
							"label",
							"page"
						]
					}
				},
				"pages": {
					"maxItems": 20,
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"path": {
								"type": "string",
								"maxLength": 200,
								"pattern": "^([a-z0-9-]+|\\[[a-z_][a-z0-9_]*\\])(\\/([a-z0-9-]+|\\[[a-z_][a-z0-9_]*\\]))*$"
							},
							"title": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"element": {
								"type": "string",
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)+$"
							},
							"load": {
								"type": "string",
								"pattern": "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
							},
							"permission": {
								"type": "string",
								"enum": [
									"organization:view",
									"content:edit",
									"content:delete-request",
									"content:delete-review",
									"organization:manage"
								]
							}
						},
						"required": [
							"path",
							"title",
							"element"
						]
					}
				},
				"assetTabs": {
					"maxItems": 10,
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"minLength": 2,
								"maxLength": 48,
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
							},
							"label": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"icon": {
								"type": "string",
								"maxLength": 64
							},
							"element": {
								"type": "string",
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)+$"
							},
							"permission": {
								"type": "string",
								"enum": [
									"organization:view",
									"content:edit",
									"content:delete-request",
									"content:delete-review",
									"organization:manage"
								]
							}
						},
						"required": [
							"id",
							"label",
							"element"
						]
					}
				},
				"widgets": {
					"maxItems": 10,
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"minLength": 2,
								"maxLength": 48,
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
							},
							"title": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"element": {
								"type": "string",
								"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)+$"
							},
							"sizes": {
								"minItems": 1,
								"type": "array",
								"items": {
									"type": "string",
									"enum": [
										"1x1",
										"2x1",
										"2x2"
									]
								}
							},
							"defaultSize": {
								"type": "string",
								"enum": [
									"1x1",
									"2x1",
									"2x2"
								]
							},
							"permission": {
								"type": "string",
								"enum": [
									"organization:view",
									"content:edit",
									"content:delete-request",
									"content:delete-review",
									"organization:manage"
								]
							}
						},
						"required": [
							"id",
							"title",
							"element",
							"sizes"
						]
					}
				},
				"settingsPanel": {
					"type": "object",
					"properties": {
						"element": {
							"type": "string",
							"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)+$"
						}
					},
					"required": [
						"element"
					]
				}
			},
			"additionalProperties": false
		}
	},
	"required": [
		"id",
		"name",
		"version",
		"publisher",
		"atlasApi"
	],
	"additionalProperties": false
}
