{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "@pilotdev/pilot-web-sdk/extensions.config.schema.json",
  "title": "Pilot Web-Extensions Config",
  "description": "JSON Schema for `extensions.config.json` file",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "The schema to verify this document against."
    },
    "manifestVersion": {
      "type": "number",
      "description": "An integer that specifies the version of the manifest file format that your extension uses.",
      "default": 1
    },
    "author": {
      "type": "string",
      "description": "Specifies author who created the extension."
    },
    "license": {
      "type": "string",
      "description": "The license under which the extension is distributed."
    },
    "title": {
      "type": "string",
      "description": "A human-readable title for the extension."
    },
    "description": {
      "type": "string",
      "description": "A detailed description of the extension's purpose and functionality."
    },
    "version": {
      "type": "string",
      "description": "A string that identifies the extension's version number.",
      "default": "1.0.0"
    },
    "extension": {
      "type": "object",
      "description": "Configuration for the Pilot Web extension",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the extension."
        },
        "description": {
          "type": "string",
          "description": "Short description of the extension's purpose and functionality."
        },
        "entry": {
          "type": "string",
          "description": "Path to the JavaScript entry point, relative to the `frontend` folder."
        },
        "modules": {
          "type": "array",
          "description": "An array of extension modules that are part of this extension.",
          "items": {
            "$ref": "#/definitions/extensionModule"
          },
          "minItems": 1
        }
      },
      "required": [
        "name",
        "entry",
        "modules"
      ]
    },
    "pilotWeb2D": {
      "type": "array",
      "description": "An array of extension modules for PilotWeb2D component of Pilot-ComponentKit",
      "items": {
        "$ref": "#/definitions/componentKitModule"
      },
      "minItems": 1
    },
    "pilotWeb3D": {
      "type": "array",
      "description": "An array of extension modules for PilotWeb3D component of Pilot-ComponentKit",
      "items": {
        "$ref": "#/definitions/componentKitModule"
      },
      "minItems": 1
    }
  },
  "required": [
    "manifestVersion",
    "title",
    "version"
  ],
  "anyOf": [
    {
      "required": [
        "extension"
      ]
    },
    {
      "required": [
        "pilotWeb2D"
      ]
    },
    {
      "required": [
        "pilotWeb3D"
      ]
    }
  ],
  "definitions": {
    "extensionModule": {
      "type": "object",
      "properties": {
        "ngModuleName": {
          "type": "string",
          "description": "Name of exported class"
        },
        "exposedInterface": {
          "type": "string",
          "description": "The interface implemented from @pilotdev/pilot-web-sdk. Must match the `exposes` key in the Module Federation config",
          "enum": [
            "ISettingsFeature",
            "IDataPlugin",
            "ICryptoProvider",
            "IToolbar<ObjectsViewContext>",
            "IToolbar<DocumentAnnotationsListContext>",
            "IObjectCardHandler",
            "IOpenspaceView<ObjectsViewContext>",
            "IOpenspaceView<BimElementPanelContext>",
            "IOpenspaceView<BimRightPanelContext>",
            "IOpenspaceView<PageContext>",
            "IOpenspaceView<SettingsFeatureContext>",
            "IOpenspaceView<DialogContext>",
            "IPageNavigation",
            "ITabs<ObjectsViewContext>",
            "ITabs<BimElementPanelContext>",
            "ITabs<BimRightPanelContext>",
            "IMenu<ObjectsViewContext>",
            "IMenu<DocumentAnnotationsListContext>"
          ]
        }
      },
      "required": [
        "ngModuleName",
        "exposedInterface"
      ]
    },
    "componentKitModule": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of exported class"
        },
        "description": {
          "type": "string",
          "description": "Short description of the Pilot-ComponentKit extension module's purpose and functionality."
        },
        "entry": {
          "type": "string",
          "description": "Path to the JavaScript entry point, relative to the `frontend` folder."
        },
        "cssEntry": {
          "type": "string",
          "description": "Path to the CSS entry point, relative to the `frontend` folder."
        }
      },
      "required": [
        "name",
        "entry"
      ]
    }
  }
}