{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PermissionFile",
  "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
  "type": "object",
  "properties": {
    "default": {
      "description": "The default permission set for the plugin",
      "anyOf": [
        {
          "$ref": "#/definitions/DefaultPermission"
        },
        {
          "type": "null"
        }
      ]
    },
    "set": {
      "description": "A list of permissions sets defined",
      "type": "array",
      "items": {
        "$ref": "#/definitions/PermissionSet"
      }
    },
    "permission": {
      "description": "A list of inlined permissions",
      "default": [],
      "type": "array",
      "items": {
        "$ref": "#/definitions/Permission"
      }
    }
  },
  "definitions": {
    "DefaultPermission": {
      "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
      "type": "object",
      "required": [
        "permissions"
      ],
      "properties": {
        "version": {
          "description": "The version of the permission.",
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 1.0
        },
        "description": {
          "description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
          "type": [
            "string",
            "null"
          ]
        },
        "permissions": {
          "description": "All permissions this set contains.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "PermissionSet": {
      "description": "A set of direct permissions grouped together under a new name.",
      "type": "object",
      "required": [
        "description",
        "identifier",
        "permissions"
      ],
      "properties": {
        "identifier": {
          "description": "A unique identifier for the permission.",
          "type": "string"
        },
        "description": {
          "description": "Human-readable description of what the permission does.",
          "type": "string"
        },
        "permissions": {
          "description": "All permissions this set contains.",
          "type": "array",
          "items": {
            "$ref": "#/definitions/PermissionKind"
          }
        }
      }
    },
    "Permission": {
      "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
      "type": "object",
      "required": [
        "identifier"
      ],
      "properties": {
        "version": {
          "description": "The version of the permission.",
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 1.0
        },
        "identifier": {
          "description": "A unique identifier for the permission.",
          "type": "string"
        },
        "description": {
          "description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
          "type": [
            "string",
            "null"
          ]
        },
        "commands": {
          "description": "Allowed or denied commands when using this permission.",
          "default": {
            "allow": [],
            "deny": []
          },
          "allOf": [
            {
              "$ref": "#/definitions/Commands"
            }
          ]
        },
        "scope": {
          "description": "Allowed or denied scoped when using this permission.",
          "allOf": [
            {
              "$ref": "#/definitions/Scopes"
            }
          ]
        },
        "platforms": {
          "description": "Target platforms this permission applies. By default all platforms are affected by this permission.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Target"
          }
        }
      }
    },
    "Commands": {
      "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
      "type": "object",
      "properties": {
        "allow": {
          "description": "Allowed command.",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "deny": {
          "description": "Denied command, which takes priority.",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "Scopes": {
      "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```",
      "type": "object",
      "properties": {
        "allow": {
          "description": "Data that defines what is allowed by the scope.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Value"
          }
        },
        "deny": {
          "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Value"
          }
        }
      }
    },
    "Value": {
      "description": "All supported ACL values.",
      "anyOf": [
        {
          "description": "Represents a null JSON value.",
          "type": "null"
        },
        {
          "description": "Represents a [`bool`].",
          "type": "boolean"
        },
        {
          "description": "Represents a valid ACL [`Number`].",
          "allOf": [
            {
              "$ref": "#/definitions/Number"
            }
          ]
        },
        {
          "description": "Represents a [`String`].",
          "type": "string"
        },
        {
          "description": "Represents a list of other [`Value`]s.",
          "type": "array",
          "items": {
            "$ref": "#/definitions/Value"
          }
        },
        {
          "description": "Represents a map of [`String`] keys to [`Value`]s.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/Value"
          }
        }
      ]
    },
    "Number": {
      "description": "A valid ACL number.",
      "anyOf": [
        {
          "description": "Represents an [`i64`].",
          "type": "integer",
          "format": "int64"
        },
        {
          "description": "Represents a [`f64`].",
          "type": "number",
          "format": "double"
        }
      ]
    },
    "Target": {
      "description": "Platform target.",
      "oneOf": [
        {
          "description": "MacOS.",
          "type": "string",
          "enum": [
            "macOS"
          ]
        },
        {
          "description": "Windows.",
          "type": "string",
          "enum": [
            "windows"
          ]
        },
        {
          "description": "Linux.",
          "type": "string",
          "enum": [
            "linux"
          ]
        },
        {
          "description": "Android.",
          "type": "string",
          "enum": [
            "android"
          ]
        },
        {
          "description": "iOS.",
          "type": "string",
          "enum": [
            "iOS"
          ]
        }
      ]
    },
    "PermissionKind": {
      "type": "string",
      "oneOf": [
        {
          "description": "Enables the append_debug_logs command without any pre-configured scope.",
          "type": "string",
          "const": "allow-append-debug-logs",
          "markdownDescription": "Enables the append_debug_logs command without any pre-configured scope."
        },
        {
          "description": "Denies the append_debug_logs command without any pre-configured scope.",
          "type": "string",
          "const": "deny-append-debug-logs",
          "markdownDescription": "Denies the append_debug_logs command without any pre-configured scope."
        },
        {
          "description": "Enables the capture_dom_snapshot command without any pre-configured scope.",
          "type": "string",
          "const": "allow-capture-dom-snapshot",
          "markdownDescription": "Enables the capture_dom_snapshot command without any pre-configured scope."
        },
        {
          "description": "Denies the capture_dom_snapshot command without any pre-configured scope.",
          "type": "string",
          "const": "deny-capture-dom-snapshot",
          "markdownDescription": "Denies the capture_dom_snapshot command without any pre-configured scope."
        },
        {
          "description": "Enables the capture_full_debug_state command without any pre-configured scope.",
          "type": "string",
          "const": "allow-capture-full-debug-state",
          "markdownDescription": "Enables the capture_full_debug_state command without any pre-configured scope."
        },
        {
          "description": "Denies the capture_full_debug_state command without any pre-configured scope.",
          "type": "string",
          "const": "deny-capture-full-debug-state",
          "markdownDescription": "Denies the capture_full_debug_state command without any pre-configured scope."
        },
        {
          "description": "Enables the capture_webview_state command without any pre-configured scope.",
          "type": "string",
          "const": "allow-capture-webview-state",
          "markdownDescription": "Enables the capture_webview_state command without any pre-configured scope."
        },
        {
          "description": "Denies the capture_webview_state command without any pre-configured scope.",
          "type": "string",
          "const": "deny-capture-webview-state",
          "markdownDescription": "Denies the capture_webview_state command without any pre-configured scope."
        },
        {
          "description": "Enables the clear_debug_log_files_command command without any pre-configured scope.",
          "type": "string",
          "const": "allow-clear-debug-log-files-command",
          "markdownDescription": "Enables the clear_debug_log_files_command command without any pre-configured scope."
        },
        {
          "description": "Denies the clear_debug_log_files_command command without any pre-configured scope.",
          "type": "string",
          "const": "deny-clear-debug-log-files-command",
          "markdownDescription": "Denies the clear_debug_log_files_command command without any pre-configured scope."
        },
        {
          "description": "Enables the copy_screenshot_to_debug_dir command without any pre-configured scope.",
          "type": "string",
          "const": "allow-copy-screenshot-to-debug-dir",
          "markdownDescription": "Enables the copy_screenshot_to_debug_dir command without any pre-configured scope."
        },
        {
          "description": "Denies the copy_screenshot_to_debug_dir command without any pre-configured scope.",
          "type": "string",
          "const": "deny-copy-screenshot-to-debug-dir",
          "markdownDescription": "Denies the copy_screenshot_to_debug_dir command without any pre-configured scope."
        },
        {
          "description": "Enables the get_console_logs command without any pre-configured scope.",
          "type": "string",
          "const": "allow-get-console-logs",
          "markdownDescription": "Enables the get_console_logs command without any pre-configured scope."
        },
        {
          "description": "Denies the get_console_logs command without any pre-configured scope.",
          "type": "string",
          "const": "deny-get-console-logs",
          "markdownDescription": "Denies the get_console_logs command without any pre-configured scope."
        },
        {
          "description": "Enables the get_log_directory command without any pre-configured scope.",
          "type": "string",
          "const": "allow-get-log-directory",
          "markdownDescription": "Enables the get_log_directory command without any pre-configured scope."
        },
        {
          "description": "Denies the get_log_directory command without any pre-configured scope.",
          "type": "string",
          "const": "deny-get-log-directory",
          "markdownDescription": "Denies the get_log_directory command without any pre-configured scope."
        },
        {
          "description": "Enables the reset_debug_logs command without any pre-configured scope.",
          "type": "string",
          "const": "allow-reset-debug-logs",
          "markdownDescription": "Enables the reset_debug_logs command without any pre-configured scope."
        },
        {
          "description": "Denies the reset_debug_logs command without any pre-configured scope.",
          "type": "string",
          "const": "deny-reset-debug-logs",
          "markdownDescription": "Denies the reset_debug_logs command without any pre-configured scope."
        },
        {
          "description": "Enables the send_debug_command command without any pre-configured scope.",
          "type": "string",
          "const": "allow-send-debug-command",
          "markdownDescription": "Enables the send_debug_command command without any pre-configured scope."
        },
        {
          "description": "Denies the send_debug_command command without any pre-configured scope.",
          "type": "string",
          "const": "deny-send-debug-command",
          "markdownDescription": "Denies the send_debug_command command without any pre-configured scope."
        },
        {
          "description": "Enables the write_debug_snapshot command without any pre-configured scope.",
          "type": "string",
          "const": "allow-write-debug-snapshot",
          "markdownDescription": "Enables the write_debug_snapshot command without any pre-configured scope."
        },
        {
          "description": "Denies the write_debug_snapshot command without any pre-configured scope.",
          "type": "string",
          "const": "deny-write-debug-snapshot",
          "markdownDescription": "Denies the write_debug_snapshot command without any pre-configured scope."
        },
        {
          "description": "Debug tools with official logging and screenshots",
          "type": "string",
          "const": "debug-with-logging",
          "markdownDescription": "Debug tools with official logging and screenshots"
        },
        {
          "description": "Allows debug-tools commands for WebView inspection and log capture.\n\n#### Granted Permissions\n\nAll debug-tools commands are enabled by default.\n\n#### Note\n\nFor full functionality, also enable official plugins:\n- `log:default` for automatic console log collection\n- `screenshots:default` for cross-platform screenshot capture\n\n\n#### This default permission set includes:\n\n- `allow-capture-webview-state`\n- `allow-get-console-logs`\n- `allow-send-debug-command`\n- `allow-append-debug-logs`\n- `allow-reset-debug-logs`\n- `allow-clear-debug-log-files-command`\n- `allow-copy-screenshot-to-debug-dir`\n- `allow-write-debug-snapshot`",
          "type": "string",
          "const": "default",
          "markdownDescription": "Allows debug-tools commands for WebView inspection and log capture.\n\n#### Granted Permissions\n\nAll debug-tools commands are enabled by default.\n\n#### Note\n\nFor full functionality, also enable official plugins:\n- `log:default` for automatic console log collection\n- `screenshots:default` for cross-platform screenshot capture\n\n\n#### This default permission set includes:\n\n- `allow-capture-webview-state`\n- `allow-get-console-logs`\n- `allow-send-debug-command`\n- `allow-append-debug-logs`\n- `allow-reset-debug-logs`\n- `allow-clear-debug-log-files-command`\n- `allow-copy-screenshot-to-debug-dir`\n- `allow-write-debug-snapshot`"
        }
      ]
    }
  }
}