{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/platform.org.user.role.update",
  "title": "platform.org.user.role.update",
  "type": "object",
  "description": "Published when a user's role in an organization is changed.\n\nChanges array as a single entry for roles  containing new and previous values.\n\n`added_roles`  and `removed_role`s  sets added to the event to more clearly identify changes to assigned roles. These can also be inferred from the difference between new and previous and vice versa.\n\n`role`  and `previous_role`  are only included if the user's Platform role is changed.",
  "x-context": "org",
  "allOf": [
    {
      "$ref": "#/components/schemas/EventDataOrg"
    },
    {
      "$ref": "#/components/schemas/EventDataActor"
    },
    {
      "$ref": "#/components/schemas/EventDataUser"
    }
  ],
  "properties": {
    "added_roles": {
      "type": "array",
      "description": "Set of roles newly assigned to the user.",
      "items": {
        "type": "string",
        "enum": [
          "administrator",
          "developer",
          "auditor",
          "consumer",
          "usage_reporter",
          "api_central_admin"
        ]
      },
      "example": [
        "administrator"
      ]
    },
    "changes": {
      "$ref": "#/components/schemas/EventDataChanges"
    },
    "previous_role": {
      "type": "string",
      "description": "Identifier of the users previous default role in the organization. Only set if the default role is changed.",
      "enum": [
        "administrator",
        "developer",
        "auditor",
        "consumer"
      ],
      "example": "administrator"
    },
    "removed_roles": {
      "type": "array",
      "description": "Set of roles no longer assigned to the user.",
      "items": {
        "type": "string",
        "enum": [
          "administrator",
          "developer",
          "auditor",
          "consumer",
          "usage_reporter",
          "api_central_admin"
        ]
      },
      "example": [
        "administrator"
      ]
    },
    "role": {
      "type": "string",
      "description": "Identifier of the users default role in the organization. Only set if the default role is changed.",
      "enum": [
        "administrator",
        "developer",
        "auditor",
        "consumer"
      ],
      "example": "administrator"
    }
  }
}