{
	"title": "A schema for Umbraco's package.manifest files.",
	"$schema": "http://json-schema.org/draft-04/schema#",

	"type": "object",

	"definitions": {
		"editor": {
			"description": "This describes details about the editor",
			"type": "object",
			"additionalProperties": false,
			"properties": {
				"view": {
					"type": "string",
					"description": "This is the full path to the HTML view for your property editor"
				},
				"hideLabel": {
					"type": "boolean",
					"description": "If set to true this hides the label for the property editor when used in Umbraco on a document type"
				},
				"valueType": {
					"type": "string",
					"description": "This is the type of data you want your property editor to save to Umbraco",
					"enum": [ "STRING", "JSON", "DATETIME", "TEXT", "INT" ]
				},
				"validation": {
					"description": "Object describing required validators on the editor",
					"type": "object"
				},
				"isReadOnly": {
					"type": "boolean",
					"description": "If set to true this makes the property editor read only",
					"default": false
				}
			}
		},
		"editors": {
			"type": "object",
			"required": [ "name", "alias", "editor" ],
			"properties": {
				"alias": {
					"type": "string",
					"description": "This must be a unique alias to your property editor"
				},
				"defaultConfig": {
					"type": "object",
					"description": "Provides a collection of default configuration values, in cases the property editor is not configured or is used a parameter editor, which doesnt allow configuration. The object is a key/value collection and must match the prevalue fields keys.",
					"minProperties": 1
				},
				"editor": {
					"$ref": "#/definitions/editor"
				},
				"isParameterEditor": {
					"type": "boolean",
					"description": "Enables the property editor as a macro parameter editor can be true/false",
					"default": false
				},
				"name": {
					"type": "string",
					"description": "The friendly name of the property editor, shown in the Umbraco backoffice"
				}
			}
		},
		"preValues": {
			"type": "object",
			"properties": {
				"prevalues": {
					"type": "object",
					"description": "This is an object that stores an array of prevalue fields or options to configure yout property editor",
					"properties": {
						"fields": {
							"$ref": "#/definitions/fields"
						}
					}
				}
			}
		},
		"fields": {
			"type": "array",
			"description": "This is the collection of prevalue fields",
			"minItems": 1,
			"items": {
				"type": "object",
				"minProperties": 1,
				"properties": {
					"key": {
						"type": "string",
						"description": "A unique key for the prevalue field",
						"minLength": 1
					},
					"label": {
						"type": "string",
						"description": "The user friendly label for the prevalue"
					},
					"description": {
						"type": "string",
						"description": "A more detailed description for the user"
					},
					"view": {
						"type": "string",
						"description": "The type of editor to use for this prevalue field"
					},
					"validation": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"type": {
									"type": "string"
								}
							}
						}
					}
				}
			}
		}
	},

	"properties": {
		"javascript": {
			"type": "array",
			"description": "A list of Javascript files with full path to load for your property editor",
			"uniqueItems": true,
			"items": {
				"type": "string"
			}
		},
		"css": {
			"type": "array",
			"description": "A list of CSS files with full path to load for your property editor",
			"uniqueItems": true,
			"items": {
				"type": "string"
			}
		},
		"propertyEditors": {
			"type": "array",
			"description": "Returns an array of editor objects, each object specifies an editor to make available to data types as an editor component. These editors are primarily property editors for content, media and members, but can also be made available as a macro parameter editor.",
			"minItems": 1,
			"items": {
				"allOf": [
					{ "$ref": "#/definitions/editors" },
					{ "$ref": "#/definitions/preValues" }
				]
			}
		},
		"parameterEditors": {
			"type": "array",
			"description": "Returns an array of editor objects, each object specifies an editor to make available to macro parameters as an editor component. These editors work solely as parameter editors, and will not show up on the property editors list.",
			"minItems": 1,
			"items": {
				"$ref": "#/definitions/editors"
			}
		}
	}
}
