{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/package-manifest/versions/7.0.0.json",
  "title": "A schema for Umbraco's package.manifest files.",
  "x-lintel": {
    "source": "https://www.schemastore.org/package.manifest-7.0.0.json",
    "sourceSha256": "29048f992b071f1935f48fcbc51be67bd080de331f1dafd2d7ebb6ee52e011cf",
    "fileMatch": [
      "package.manifest"
    ]
  },
  "type": "object",
  "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": "#/$defs/editors"
          },
          {
            "$ref": "#/$defs/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": "#/$defs/editors"
      }
    },
    "gridEditors": {
      "type": "array",
      "description": "Returns an array of grid editor objects, each object specifies a grid editor to make available in the Grid Layout property editor.",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/gridEditor"
      }
    }
  },
  "id": "https://json.schemastore.org/package.manifest-7.0.0.json",
  "$defs": {
    "editor": {
      "description": "This describes details about the editor",
      "type": "object",
      "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
        }
      },
      "additionalProperties": 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 doesn't allow configuration. The object is a key/value collection and must match the prevalue fields keys.",
          "minProperties": 1
        },
        "editor": {
          "$ref": "#/$defs/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"
        },
        "icon": {
          "type": "string",
          "description": "A CSS class for the icon to be used in the 'Select Editor' dialog eg: icon-autofill"
        },
        "group": {
          "type": "string",
          "description": "The group to place this editor in within the 'Select Editor' dialog. Use a new group name or alternatively use an existing one such as 'Pickers'"
        }
      }
    },
    "gridEditor": {
      "type": "object",
      "required": [
        "name",
        "alias",
        "view"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The friendly name of the grid editor, shown in the Umbraco backoffice"
        },
        "alias": {
          "type": "string",
          "description": "This must be a unique alias to your grid editor"
        },
        "icon": {
          "type": "string",
          "description": "A CSS class for the icon to be used in the 'Select Editor' dialog eg: icon-autofill"
        },
        "view": {
          "type": "string",
          "description": "This is backoffice HTML view for your grid editor. Either refers to one of the built-in view (textstring, rte, embed, macro, media) or the full path to a custom view eg.: '~/App_Plugins/FolderName/editor.html'"
        },
        "render": {
          "type": "string",
          "description": "This is front end razor view for your grid editor. Accepts full path to a custom view eg.: '~/App_Plugins/FolderName/editor.cshtml"
        },
        "config": {
          "type": "object",
          "description": "Configuration for the grid editor. Can be used with textstring and media views or for custom configuration properties",
          "minProperties": 1,
          "properties": {
            "style": {
              "type": "string",
              "description": "If used with the textstring view this accepts inline css to style the textstring box eg.: font-size: 30px; line-height: 40px; font-weight: bold"
            },
            "markup": {
              "type": "string",
              "description": "If used with the textstring view this allows wrapping the value in custom markup eg.: <h2>#value#</h2>"
            },
            "size": {
              "type": "object",
              "description": "If used with the media view this accepts height and width key/value pairs for cropping",
              "properties": {
                "height": {
                  "type": "integer",
                  "description": "Height of image in pixels"
                },
                "width": {
                  "type": "integer",
                  "description": "Width of image in pixels"
                }
              }
            }
          }
        }
      }
    },
    "preValues": {
      "type": "object",
      "properties": {
        "prevalues": {
          "type": "object",
          "description": "This is an object that stores an array of prevalue fields or options to configure your property editor",
          "properties": {
            "fields": {
              "$ref": "#/$defs/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"
                }
              }
            }
          }
        }
      }
    }
  }
}
