{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/axway/main/json-schema/axway-platform-org-user-role-update-schema.json",
  "title": "platform.org.user.role.update",
  "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-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/axway-activity-api-openapi.yml#/components/schemas/platform.org.user.role.update",
  "type": "object",
  "x-context": "org",
  "allOf": [
    {
      "$ref": "#/$defs/EventDataOrg"
    },
    {
      "$ref": "#/$defs/EventDataActor"
    },
    {
      "$ref": "#/$defs/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"
        ]
      }
    },
    "changes": {
      "$ref": "#/$defs/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"
      ]
    },
    "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"
        ]
      }
    },
    "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"
      ]
    }
  },
  "$defs": {
    "EventDataActionClient": {
      "type": "object",
      "title": "Action Service Account",
      "properties": {
        "action_client_guid": {
          "description": "The `guid` of the client that performed the action.",
          "allOf": [
            {
              "$ref": "#/$defs/guid"
            }
          ]
        },
        "action_client_id": {
          "description": "The `client_id` of the client that performed the action.",
          "allOf": [
            {
              "$ref": "#/$defs/client_id"
            }
          ]
        },
        "action_client_name": {
          "description": "The `name` of the client that performed the action.",
          "allOf": [
            {
              "$ref": "#/$defs/name"
            }
          ]
        }
      }
    },
    "EventDataActionUser": {
      "type": "object",
      "title": "Action User",
      "properties": {
        "action_user_guid": {
          "description": "The `guid` of the user that performed the action",
          "allOf": [
            {
              "$ref": "#/$defs/guid"
            }
          ]
        }
      }
    },
    "EventDataActor": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/EventDataActionUser"
        },
        {
          "$ref": "#/$defs/EventDataActionClient"
        }
      ]
    },
    "EventDataChanges": {
      "type": "array",
      "description": "Changes that were made.",
      "items": {
        "type": "object",
        "required": [
          "k"
        ],
        "properties": {
          "a": {
            "type": "integer",
            "description": "Action indication for changes to sensitive data. Values represent added, changed, and removed respectively.",
            "enum": [
              0,
              1,
              2
            ]
          },
          "k": {
            "type": "string",
            "description": "The full path to the modified value."
          },
          "o": {
            "description": "The original value."
          },
          "v": {
            "description": "The new value."
          }
        }
      }
    },
    "EventDataOrg": {
      "type": "object",
      "properties": {
        "org_guid": {
          "$ref": "#/$defs/guid"
        },
        "org_id": {
          "$ref": "#/$defs/org_id"
        },
        "org_name": {
          "$ref": "#/$defs/name"
        },
        "provider_guid": {
          "$ref": "#/$defs/provider_guid"
        },
        "region": {
          "$ref": "#/$defs/region"
        }
      }
    },
    "EventDataUser": {
      "type": "object",
      "title": "User",
      "properties": {
        "provider_guid": {
          "$ref": "#/$defs/provider_guid"
        },
        "user_guid": {
          "$ref": "#/$defs/guid"
        }
      }
    }
  }
}