{
  "id": "prefab-app-manifest.schema.json",
  "title": "PREFAB application manifest",
  "description": "A PREFAB application is the architectural component that allows developers to declaratively specify behavior of a full page application.",

  "definitions": {
    "prefabAppSiteScript": {
      "title": "PREFAB Application Site Script",
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["onInstall", "onDemand"]
              },
              "actions": {
                "$ref": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json#/properties/actions"
              }
            },
            "required": ["type", "actions"],
            "additionalProperties": false
          }
        ]
      }
    }
  },

  "type": "object",
  "allOf": [
    {
      "type": "object",

      "properties": {
        "$schema": {
          "type": "string",
          "minLength": 1
        },

        "manifestVersion": { "$ref": "any-value.schema.json" },
        "id": { "$ref": "any-value.schema.json" },
        "alias": { "$ref": "any-value.schema.json" },
        "version": { "$ref": "any-value.schema.json" },
        "loaderConfig": { "$ref": "any-value.schema.json" },
        "componentType": { "$ref": "any-value.schema.json" },
        "preloadComponents": { "$ref": "any-value.schema.json" },
        "title": { "$ref": "any-value.schema.json" },
        "description": { "$ref": "any-value.schema.json" },
        "isConfigured": { "$ref": "any-value.schema.json" },
        "siteSettingsLinks": { "$ref": "any-value.schema.json" },
        "toolboxEntries": { "$ref": "any-value.schema.json" },
        "appInstallationTypes": {
          "description": "Describes how the PREFAB app can be installed: NewSite or ExistingSite. If omitted the app supports both.",
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["NewSite", "ExistingSite"]
          }
        },
        "actions": { "$ref": "any-value.schema.json" }
      },
      "additionalProperties": false
    },
    {
      "$ref": "client-side-component-manifest.schema.json#/definitions/clientSideComponentManifest"
    },
    {
      "type": "object",
      "required": ["componentType", "title", "description", "isConfigured"],
      "properties": {
        "componentType": {
          "type": "string",
          "enum": ["Prefab"]
        },

        "title": {
          "title": "Title",
          "description": "Title of the application as a dictionary of locale keys to title values. This value will be displayed to the user in the (page creation) interface. A dictionary must contain a \"default\" key.",
          "$ref": "localized-string.schema.json"
        },

        "description": {
          "title": "Description",
          "description": "Description of the application represented as a dictionary of locale keys to description values. This value will be displayed to the user in the (page creation) interface. A dictionary must contain a \"default\" key.",
          "$ref": "localized-string.schema.json"
        },

        "isConfigured": {
          "title": "Is configured",
          "description": "True if the application is configured and not need a FRC (First Run Configuration) step.",
          "type": "boolean"
        },

        "siteSettingsLinks": {
          "title": "Site settings links",
          "description": "Links to be rendered in the suite nav site settings menu for the PREFAB App.",
          "type": "array",
          "minItems": 1,
          "items": {
            "description": "Represents an item that should be rendered in the suite nav site settings menu.",
            "type": "object",
            "properties": {
              "viewId": {
                "title": "Route ID",
                "description": "The unique identifier of the route to be rendered when the settings link is selected.",
                "type": "string",
                "minLength": 1
              },
              "text": {
                "title": "Text",
                "description": "Text of the link represented as a dictionary of locale keys to title values. This value will be displayed to the user in the suite nav site settings menu.",
                "$ref": "localized-string.schema.json"
              }
            },
            "required": ["viewId", "text"],
            "additionalProperties": false
          }
        },

        "toolboxEntries": {
          "title": "Toolbox entries",
          "description": "Toolbox entries for the PREFAB app.",
          "type": "array",
          "minItems": 1,
          "items": {
            "description": "This interface specifies the set of that can be provided by a PREFAB developer if the application should be available in the modern SharePoint toolbox.",
            "type": "object",
            "properties": {
              "viewId": {
                "title": "Route ID",
                "description": "The unique identifier of the route to be rendered if the entry is added to the page.",
                "type": "string",
                "minLength": 1
              },
              "title": {
                "title": "Title",
                "description": "Title of the PREFAB entry represented as a single a dictionary of locale keys to title values. This value will be displayed to the user in the toolbox.",
                "$ref": "localized-string.schema.json"
              },
              "description": {
                "title": "Description",
                "description": "Description of the PREFAB entry represented as a dictionary of locale keys to description values. This value will be displayed to the user in the toolbox.",
                "$ref": "localized-string.schema.json"
              },
              "officeFabricIconFontName": {
                "title": "Office Fabric Icon Name",
                "description": "The icon for the PREFAB entry, to be displayed in the toolbox, represented as a character name in the Office 365 icon font file. The icon font is specified here: https://aka.ms/uifabric-icons. If this field has a value, the 'iconImageUrl' field will be ignored.",
                "type": "string",
                "minLength": 1
              },

              "iconImageUrl": {
                "title": "Icon Image URL",
                "description": "The icon for the PREFAB app, to be displayed in the toolbox, represented an image URL. The image at the URL must be exactly 38x38 px. If the 'officeFabricIconName' field does not have a value, this field must have a value.",
                "type": "string",
                "minLength": 10
              }
            },
            "anyOf": [
              {
                "required": ["viewId", "title", "description", "officeFabricIconFontName"]
              },
              {
                "required": ["viewId", "title", "description", "iconImageUrl"]
              }
            ],
            "additionalProperties": false
          }
        },

        "actions": {
          "$ref": "#/definitions/prefabAppSiteScript"
        }
      },

      "additionalProperties": true
    }
  ]
}
