{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "version": {
      "type": "number",
      "const": 1
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "orgId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "at": {
      "type": "string"
    },
    "action": {
      "type": "string",
      "enum": [
        "orgs.org.create",
        "orgs.org.rename",
        "orgs.member.add",
        "orgs.member.remove",
        "orgs.member.leave",
        "orgs.member.role",
        "orgs.owner.transfer",
        "orgs.invite.create",
        "orgs.invite.revoke",
        "orgs.invite.accept",
        "orgs.key.create",
        "orgs.key.reveal",
        "orgs.key.revoke",
        "orgs.diagram.publish",
        "orgs.diagram.update",
        "orgs.diagram.edit",
        "orgs.diagram.restore",
        "orgs.diagram.lock",
        "orgs.diagram.unlock",
        "orgs.diagram.delete",
        "orgs.folder_rule.set",
        "orgs.folder_rule.clear",
        "orgs.brand.set",
        "orgs.brand.clear",
        "orgs.icon.set",
        "orgs.icon.delete",
        "orgs.avatar.set",
        "orgs.avatar.clear",
        "orgs.style_rules.set",
        "orgs.style_rules.clear",
        "orgs.settings.editable",
        "orgs.settings.publishing",
        "orgs.publishing.move",
        "orgs.publishing.unpublish",
        "orgs.drift.report",
        "orgs.drift.settings",
        "orgs.integration.create",
        "orgs.integration.update",
        "orgs.integration.delete",
        "orgs.contract.set",
        "orgs.contract.end",
        "orgs.audit.export",
        "orgs.sso.signin",
        "orgs.sso.config",
        "orgs.sso.domain_add",
        "orgs.sso.domain_verify",
        "orgs.sso.domain_remove",
        "orgs.sso.signin_failed",
        "orgs.sso.jit",
        "orgs.sso.break_glass",
        "orgs.scim.token",
        "orgs.scim.user_create",
        "orgs.scim.user_update",
        "orgs.scim.user_deactivate",
        "orgs.scim.user_delete",
        "orgs.scim.group",
        "orgs.scim.role"
      ]
    },
    "actor": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "user",
            "key",
            "ci",
            "operator"
          ]
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "target": {
      "type": "object",
      "properties": {
        "type": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "org",
                "member",
                "invite",
                "key",
                "diagram",
                "folder",
                "brand",
                "icon",
                "avatar",
                "style_rules",
                "settings",
                "drift",
                "contract",
                "sso"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "type",
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "metadata": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "ip": {
      "type": [
        "string",
        "null"
      ]
    },
    "userAgent": {
      "type": [
        "string",
        "null"
      ]
    },
    "requestId": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "version",
    "id",
    "orgId",
    "at",
    "action",
    "actor",
    "target",
    "metadata",
    "ip",
    "userAgent",
    "requestId"
  ],
  "additionalProperties": false,
  "$id": "https://docs.plotwork.dev/schemas/plotwork.audit-event.json",
  "title": "Plotwork organisation audit event",
  "description": "One event of an organisation audit log, as GET /orgs/{org}/audit answers it and as each line of a JSON Lines export holds it. version 1: a field may be added, and nothing is removed or changes meaning without a new version."
}
