{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modoboa/json-schema/modoboa-frontend-plugin-manifest-schema.json",
  "title": "FrontendPluginManifest",
  "description": "Serializer used to expose a plugin manifest to the frontend.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/modoboa-frontend-api-openapi.yml#/components/schemas/FrontendPluginManifest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "remote": {
      "allOf": [
        {
          "$ref": "#/$defs/FrontendRemote"
        }
      ]
    },
    "menu_entries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FrontendMenuEntry"
      }
    },
    "routes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FrontendRoute"
      }
    },
    "ui_extensions": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/FrontendUIExtension"
        }
      }
    }
  },
  "required": [
    "label",
    "name"
  ],
  "$defs": {
    "CategoryEnum": {
      "enum": [
        "admin",
        "user",
        "account"
      ],
      "type": "string",
      "description": "* `admin` - admin\n* `user` - user\n* `account` - account"
    },
    "FormatEnum": {
      "enum": [
        "esm",
        "systemjs",
        "var"
      ],
      "type": "string",
      "description": "* `esm` - esm\n* `systemjs` - systemjs\n* `var` - var"
    },
    "FrontendMenuEntry": {
      "type": "object",
      "description": "Serializer used to describe a menu entry exposed by a plugin.",
      "properties": {
        "label": {
          "type": "string"
        },
        "icon": {
          "type": [
            "string",
            "null"
          ]
        },
        "to": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "category": {
          "allOf": [
            {
              "$ref": "#/$defs/CategoryEnum"
            }
          ],
          "default": "admin"
        },
        "children": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        }
      },
      "required": [
        "label"
      ]
    },
    "FrontendRemote": {
      "type": "object",
      "description": "Serializer describing a Module Federation remote exposed by a plugin.",
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "format": {
          "allOf": [
            {
              "$ref": "#/$defs/FormatEnum"
            }
          ],
          "default": "esm"
        }
      },
      "required": [
        "name",
        "url"
      ]
    },
    "FrontendRoute": {
      "type": "object",
      "description": "Serializer used to describe a frontend route exposed by a plugin.",
      "properties": {
        "name": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "component": {
          "type": "string"
        },
        "parent": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": {}
        },
        "props": {
          "type": "object",
          "additionalProperties": {}
        },
        "children": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        }
      },
      "required": [
        "component",
        "name",
        "path"
      ]
    },
    "FrontendUIExtension": {
      "type": "object",
      "description": "Generic serializer for a UI extension descriptor.\n\nPlugin-specific shapes are validated against this loose schema; any\nextra keys declared by a plugin are passed through unchanged so that\nextension points can interpret them as needed on the frontend.",
      "properties": {
        "name": {
          "type": "string"
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "component": {
          "type": [
            "string",
            "null"
          ]
        },
        "position": {
          "allOf": [
            {
              "$ref": "#/$defs/FrontendUIExtensionPosition"
            }
          ]
        },
        "applies_to": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "props": {
          "type": "object",
          "additionalProperties": {}
        },
        "summary": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "name"
      ]
    },
    "FrontendUIExtensionPosition": {
      "type": "object",
      "description": "Serializer describing where a UI extension item should be inserted.",
      "properties": {
        "after": {
          "type": [
            "string",
            "null"
          ]
        },
        "before": {
          "type": [
            "string",
            "null"
          ]
        },
        "at": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    }
  }
}