{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "imports-v2/roles.json",
  "title": "Roles",
  "description": "A named access role for spaces, folders and documents, such as \"Metric analyst\". The role is built on one of three templates (reader, writer, admin) that decide its permissions; free-form permissions are not accepted. Give roles to users and groups with `role_refs` of `tree_entity_roles`; `reader`, `writer` and `admin` are the names of the built-in roles, so a role cannot have one of them as its external_id. A role only applies to the records of the package and never changes company-wide rights. A package with groups or roles of your own can be imported only by a user with the Members management permission, and only if the tariff includes groups.",
  "type": "object",
  "properties": {
    "external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Your own identifier of the record, for example `k-mrr`, unique within the resource across all of its files and case sensitive. Other records refer to this one by it."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Name of the role, for example `Metric analyst`. Up to 128 characters."
    },
    "template": {
      "type": "string",
      "enum": [
        "reader",
        "writer",
        "admin"
      ],
      "description": "The built-in role whose permissions this role gets: `reader`, `writer` or `admin`."
    }
  },
  "required": [
    "external_id",
    "name",
    "template"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "properties": {
        "external_id": {
          "not": {
            "enum": [
              "reader",
              "writer",
              "admin"
            ]
          }
        }
      }
    }
  ]
}
