{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/markmesh-com/json-schema/markmesh-com-activity-schema.json",
  "title": "activity",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/markmesh-com-openapi.json#/components/schemas/activity",
  "additionalProperties": false,
  "properties": {
    "attributes": {
      "additionalProperties": false,
      "description": "An attributes object for a activity.",
      "properties": {
        "action": {
          "description": "Human-readable event name, e.g. organization_updated, filing_phase_changed.",
          "type": "string"
        },
        "action_type": {
          "anyOf": [
            {
              "enum": [
                "create",
                "update",
                "destroy",
                "transition",
                "access"
              ],
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Structured action classification for querying."
        },
        "actor_id": {
          "anyOf": [
            {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Who did it (FK → users, nil for system actions)."
        },
        "actor_role": {
          "description": "Role of the actor: account (self), admin (staff), system (automated).",
          "enum": [
            "account",
            "admin",
            "system"
          ],
          "type": "string"
        },
        "actor_type": {
          "description": "Principal type. `user` = dashboard interactive actor, `api_key` = machine integration, `system` = internal worker (no end-user).",
          "enum": [
            "user",
            "api_key",
            "system"
          ],
          "type": "string"
        },
        "category": {
          "anyOf": [
            {
              "enum": [
                "data",
                "security",
                "access",
                "admin",
                "gdpr"
              ],
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Business category for filtering and reporting."
        },
        "entity_id": {
          "anyOf": [
            {
              "type": [
                "string",
                "null"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "ID of the affected record (string to support any ID type)."
        },
        "entity_type": {
          "description": "What was changed: user, organization, client, trademark, filing, secret, office, integration, suppression, cronjob, doi_challenge, system.",
          "type": "string"
        },
        "inserted_at": {
          "description": ""
        },
        "metadata": {
          "description": "Context: request_id, source, organization_id, structured per event-type.",
          "type": "object"
        }
      },
      "required": [
        "entity_type",
        "action",
        "actor_role",
        "actor_type",
        "metadata",
        "inserted_at"
      ],
      "type": "object"
    },
    "id": {
      "description": "Resource UUID.",
      "format": "uuid",
      "type": "string"
    },
    "type": {
      "description": "JSON:API resource type. Always `\"activity\"`.",
      "enum": [
        "activity"
      ],
      "type": "string"
    }
  },
  "required": [
    "type",
    "id"
  ],
  "type": "object"
}