{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "imports-v2/user_groups.json",
  "title": "User groups",
  "description": "A group of users, such as a team or a department. Members are listed in `user_refs`, administrators in `admin_refs`, and the spaces and documents a group can open are given by `tree_entity_roles` with the group as `member_ref`. A group with the same name already in the target is reused, and names are distinct without regard to case. A reused group keeps its own members and administrators: `user_refs` and `admin_refs` are added only to groups the import creates, and the import reports the ones it skipped. 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": 512,
      "description": "Name of the group, for example `Analytics team`. Up to 512 characters; names are distinct without regard to case."
    },
    "add_to_cards_and_spaces_enabled": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether all members of the group can be added to cards at once in the spaces the group can open, and logged time can be filtered by the group in timesheets. Leave it out for the default of the target."
    },
    "user_refs": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512,
        "x-ref": "users"
      },
      "uniqueItems": true,
      "minItems": 1,
      "description": "The members of the group, at least one, by the external_id of `users` records, for example `[\"u-ava\", \"u-liam\"]`. Each user at most once. A group without members gives nobody access, so leave such a group out of the package."
    },
    "admin_refs": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512,
        "x-ref": "users"
      },
      "uniqueItems": true,
      "description": "The administrators of the group, by the external_id of `users` records. An administrator does not have to be a member; list the user in `user_refs` too for membership. Each user at most once.",
      "default": []
    }
  },
  "required": [
    "external_id",
    "name",
    "user_refs"
  ],
  "additionalProperties": false
}
