{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-install-extension-response-schema.json",
  "title": "InstallExtensionResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-extension-installations-api-openapi.yml#/components/schemas/InstallExtensionResponse",
  "type": "object",
  "properties": {
    "installation": {
      "$ref": "#/$defs/ExtensionInstallation"
    },
    "credentials": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "apiKey": {
              "type": "string",
              "x-sensitive": true
            },
            "webhookSecret": {
              "type": "string",
              "x-sensitive": true
            }
          },
          "required": [
            "apiKey",
            "webhookSecret"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "installation",
    "credentials"
  ],
  "additionalProperties": false,
  "$defs": {
    "ExtensionId": {
      "type": "string",
      "pattern": "^ext_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "ExtensionId"
    },
    "ExtensionInstallation": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/ExtensionInstallationId"
        },
        "extensionId": {
          "$ref": "#/$defs/ExtensionId"
        },
        "name": {
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "version": {
          "$ref": "#/$defs/ExtensionVersionRef"
        },
        "runtime": {
          "type": "string",
          "enum": [
            "hosted",
            "webhook"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "disabled"
          ]
        },
        "createdAt": {
          "type": "string"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "mailbox.message.received",
              "mailbox.message.sent",
              "mailbox.action.pending_approval",
              "mailbox.action.resolved",
              "mailbox.message.quarantined",
              "mailbox.message.released",
              "mailbox.message.discarded"
            ]
          }
        },
        "permissions": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "read",
              "update",
              "send",
              "quarantine.read"
            ]
          }
        },
        "sendMode": {
          "type": "string",
          "enum": [
            "send",
            "approval"
          ]
        },
        "scope": {
          "type": "object",
          "properties": {
            "mailboxIds": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/MailboxId"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "namespaceId": {
              "anyOf": [
                {
                  "$ref": "#/$defs/NamespaceId"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "mailboxIds",
            "namespaceId"
          ],
          "additionalProperties": false
        },
        "webhook": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "endpointId": {
                  "$ref": "#/$defs/WebhookEndpointId"
                },
                "url": {
                  "type": "string"
                }
              },
              "required": [
                "endpointId",
                "url"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedAt": {
          "type": "string"
        },
        "disabledAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "extensionId",
        "name",
        "displayName",
        "version",
        "runtime",
        "status",
        "createdAt",
        "events",
        "permissions",
        "sendMode",
        "scope",
        "webhook",
        "updatedAt",
        "disabledAt"
      ],
      "additionalProperties": false
    },
    "ExtensionInstallationId": {
      "type": "string",
      "pattern": "^exti_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "ExtensionInstallationId"
    },
    "ExtensionVersionId": {
      "type": "string",
      "pattern": "^extver_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "ExtensionVersionId"
    },
    "ExtensionVersionRef": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/ExtensionVersionId"
        },
        "version": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "version"
      ],
      "additionalProperties": false
    },
    "MailboxId": {
      "type": "string",
      "pattern": "^mbx_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "MailboxId"
    },
    "NamespaceId": {
      "type": "string",
      "pattern": "^ns_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "NamespaceId"
    },
    "WebhookEndpointId": {
      "type": "string",
      "pattern": "^wep_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "WebhookEndpointId"
    }
  }
}