{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Garoon plugin manifest.json",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "plugin_code": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "manifest_version": {
      "type": "integer",
      "minimum": 1
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "target_applications": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": ["ALL"]
      }
    },
    "impacted_applications": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "ALL",
          "PORTAL",
          "SPACE",
          "BOOKMARKS",
          "SCHEDULER",
          "MESSAGES",
          "BULLETIN_BOARD",
          "CABINET",
          "MEMO",
          "PHONE_MESSAGES",
          "TIMESHEET",
          "ADDRESS_BOOK",
          "EMAIL",
          "WORKFLOW",
          "MULTI_REPORT",
          "PRESENCE_INDICATORS",
          "FAVORITE",
          "NOTIFICATIONS",
          "RESPOND"
        ]
      }
    },
    "name": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ja": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "zh": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "zh-tw": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        }
      },
      "required": [
        "en"
      ]
    },
    "description": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ja": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "zh": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "zh-tw": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "en"
      ]
    },
    "icon": {
      "type": "string",
      "description": "internal only",
      "minLength": 1,
      "format": "relative-path",
      "maxFileSize": "20MB"
    },
    "homepage_url": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ja": {
          "type": "string",
          "minLength": 1,
          "format": "http-url"
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "format": "http-url"
        },
        "zh": {
          "type": "string",
          "minLength": 1,
          "format": "http-url"
        },
        "zh-tw": {
          "type": "string",
          "minLength": 1,
          "format": "http-url"
        }
      }
    },
    "provider": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ja": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "minLength": 1,
              "format": "https-url"
            }
          },
          "required": [
            "name",
            "url"
          ]
        },
        "en": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "minLength": 1,
              "format": "https-url"
            }
          },
          "required": [
            "name",
            "url"
          ]
        },
        "zh": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "minLength": 1,
              "format": "https-url"
            }
          },
          "required": [
            "name",
            "url"
          ]
        },
        "zh-tw": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "minLength": 1,
              "format": "https-url"
            }
          },
          "required": [
            "name",
            "url"
          ]
        }
      },
      "required": [
        "en"
      ]
    },
    
    "desktop": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "js": {
          "$ref": "#/definitions/resources"
        },
        "css": {
          "$ref": "#/definitions/resources"
        }
      }
    },
    "config": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "html": {
          "description": "internal only",
          "type": "string",
          "format": "relative-path",
          "maxFileSize": "65535B",
          "minLength": 1
        },
        "js": {
          "$ref": "#/definitions/resources"
        },
        "css": {
          "$ref": "#/definitions/resources"
        },
        "required_params": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      },
      "required": [
        "html"
      ]
    }
  },
  "required": [
    "manifest_version",
    "version",
    "target_applications",
    "impacted_applications",
    "name",
    "icon"
  ],
  "definitions": {
    "resources": {
      "id": "#resources",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "anyOf": [{
          "format": "https-url"
        }, {
          "format": "relative-path",
          "maxFileSize": "20MB"
        }],
        "maxItems": 30
      }
    }
  }
}
