# This file is auto-generated by oagen. Do not edit.

"""Model round-trip tests: from_dict(to_dict()) preserves data."""

from tests.generated_helpers import load_fixture
from workos.common.models import (
    AccessTokenAgentRegistrationCredentialIssuedDataDetail,
    ActionAuthenticationDenied,
    ActionAuthenticationDeniedData,
    ActionUserRegistrationDenied,
    ActionUserRegistrationDeniedData,
    AgentRegistrationClaimAttemptCreated,
    AgentRegistrationClaimAttemptCreatedData,
    AgentRegistrationClaimCompleted,
    AgentRegistrationClaimCompletedData,
    AgentRegistrationClaimCompletedDataClaimedBy,
    AgentRegistrationCreated,
    AgentRegistrationCreatedData,
    AgentRegistrationCreatedDataAgentIdentity,
    AgentRegistrationCredentialIssued,
    AgentRegistrationCredentialIssuedData,
    AgentRegistrationCredentialIssuedDataDetail,
    AgentRegistrationDeleted,
    AgentRegistrationDeletedData,
    AgentRegistrationExpired,
    AgentRegistrationExpiredData,
    AgentRegistrationOrganizationSwitched,
    AgentRegistrationOrganizationSwitchedData,
    AgentRegistrationRevoked,
    AgentRegistrationRevokedData,
    ApiKeyCreated,
    ApiKeyCreatedData,
    ApiKeyCreatedDataOwner,
    ApiKeyRevoked,
    ApiKeyRevokedData,
    ApiKeyRevokedDataOwner,
    ApiKeyUpdated,
    ApiKeyUpdatedData,
    ApiKeyUpdatedDataOwner,
    ApiKeyUpdatedDataPreviousAttribute,
    AuthenticationEmailVerificationFailed,
    AuthenticationEmailVerificationFailedData,
    AuthenticationEmailVerificationFailedDataError,
    AuthenticationEmailVerificationSucceeded,
    AuthenticationEmailVerificationSucceededData,
    AuthenticationMagicAuthFailed,
    AuthenticationMagicAuthFailedData,
    AuthenticationMagicAuthFailedDataError,
    AuthenticationMagicAuthSucceeded,
    AuthenticationMagicAuthSucceededData,
    AuthenticationMFAFailed,
    AuthenticationMFAFailedData,
    AuthenticationMFAFailedDataError,
    AuthenticationMFASucceeded,
    AuthenticationMFASucceededData,
    AuthenticationOAuthFailed,
    AuthenticationOAuthFailedData,
    AuthenticationOAuthFailedDataError,
    AuthenticationOAuthSucceeded,
    AuthenticationOAuthSucceededData,
    AuthenticationPasskeyFailed,
    AuthenticationPasskeyFailedData,
    AuthenticationPasskeyFailedDataError,
    AuthenticationPasskeySucceeded,
    AuthenticationPasskeySucceededData,
    AuthenticationPasswordFailed,
    AuthenticationPasswordFailedData,
    AuthenticationPasswordFailedDataError,
    AuthenticationPasswordSucceeded,
    AuthenticationPasswordSucceededData,
    AuthenticationRadarRiskDetected,
    AuthenticationRadarRiskDetectedData,
    AuthenticationReauthenticationSucceeded,
    AuthenticationReauthenticationSucceededData,
    AuthenticationSSOFailed,
    AuthenticationSSOFailedData,
    AuthenticationSSOFailedDataError,
    AuthenticationSSOFailedDataSSO,
    AuthenticationSSOStarted,
    AuthenticationSSOStartedData,
    AuthenticationSSOStartedDataSSO,
    AuthenticationSSOSucceeded,
    AuthenticationSSOSucceededData,
    AuthenticationSSOSucceededDataSSO,
    AuthenticationSSOTimedOut,
    AuthenticationSSOTimedOutData,
    AuthenticationSSOTimedOutDataError,
    AuthenticationSSOTimedOutDataSSO,
    AuthMethodMismatchError,
    ConnectApplicationM2M,
    ConnectApplicationOAuth,
    ConnectApplicationOAuthRedirectUris,
    ConnectionActivated,
    ConnectionActivatedData,
    ConnectionActivatedDataDomain,
    ConnectionDeactivated,
    ConnectionDeactivatedData,
    ConnectionDeactivatedDataDomain,
    ConnectionDeleted,
    ConnectionDeletedData,
    ConnectionSAMLCertificateRenewalRequired,
    ConnectionSAMLCertificateRenewalRequiredData,
    ConnectionSAMLCertificateRenewalRequiredDataCertificate,
    ConnectionSAMLCertificateRenewalRequiredDataConnection,
    ConnectionSAMLCertificateRenewed,
    ConnectionSAMLCertificateRenewedData,
    ConnectionSAMLCertificateRenewedDataCertificate,
    ConnectionSAMLCertificateRenewedDataConnection,
    DirectoryUser,
    DirectoryUserEmail,
    DsyncActivated,
    DsyncActivatedData,
    DsyncActivatedDataDomain,
    DsyncDeleted,
    DsyncDeletedData,
    DsyncGroupCreated,
    DsyncGroupDeleted,
    DsyncGroupUpdated,
    DsyncGroupUpdatedData,
    DsyncGroupUserAdded,
    DsyncGroupUserAddedData,
    DsyncGroupUserRemoved,
    DsyncGroupUserRemovedData,
    DsyncTokenCreated,
    DsyncTokenCreatedData,
    DsyncTokenRevoked,
    DsyncTokenRevokedData,
    DsyncUserCreated,
    DsyncUserDeleted,
    DsyncUserUpdated,
    DsyncUserUpdatedData,
    DsyncUserUpdatedDataEmail,
    EmailVerificationCreated,
    EmailVerificationCreatedData,
    ErrorResponse,
    EventContext,
    EventContextActor,
    EventContextGoogleAnalyticsSession,
    FlagCreated,
    FlagCreatedContext,
    FlagCreatedContextActor,
    FlagCreatedData,
    FlagCreatedDataOwner,
    FlagDeleted,
    FlagDeletedContext,
    FlagDeletedContextActor,
    FlagDeletedData,
    FlagDeletedDataOwner,
    FlagRuleUpdated,
    FlagRuleUpdatedContext,
    FlagRuleUpdatedContextActor,
    FlagRuleUpdatedContextConfiguredTarget,
    FlagRuleUpdatedContextConfiguredTargetOrganization,
    FlagRuleUpdatedContextConfiguredTargetUser,
    FlagRuleUpdatedContextPreviousAttribute,
    FlagRuleUpdatedContextPreviousAttributeContext,
    FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget,
    FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization,
    FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser,
    FlagRuleUpdatedContextPreviousAttributeData,
    FlagRuleUpdatedData,
    FlagRuleUpdatedDataOwner,
    FlagUpdated,
    FlagUpdatedContext,
    FlagUpdatedContextActor,
    FlagUpdatedContextPreviousAttribute,
    FlagUpdatedContextPreviousAttributeData,
    FlagUpdatedData,
    FlagUpdatedDataOwner,
    GroupCreated,
    GroupDeleted,
    GroupMemberAdded,
    GroupMemberAddedData,
    GroupMemberRemoved,
    GroupMemberRemovedData,
    GroupUpdated,
    InvitationAccepted,
    InvitationAcceptedData,
    InvitationCreated,
    InvitationCreatedData,
    InvitationResent,
    InvitationResentData,
    InvitationRevoked,
    InvitationRevokedData,
    MagicAuthCreated,
    MagicAuthCreatedData,
    OrganizationCreated,
    OrganizationCreatedData,
    OrganizationCreatedDataDomain,
    OrganizationDeleted,
    OrganizationDeletedData,
    OrganizationDeletedDataDomain,
    OrganizationDomainCreated,
    OrganizationDomainCreatedData,
    OrganizationDomainDeleted,
    OrganizationDomainDeletedData,
    OrganizationDomainUpdated,
    OrganizationDomainUpdatedData,
    OrganizationDomainVerificationFailed,
    OrganizationDomainVerificationFailedData,
    OrganizationDomainVerificationFailedDataOrganizationDomain,
    OrganizationDomainVerified,
    OrganizationDomainVerifiedData,
    OrganizationMembershipCreated,
    OrganizationMembershipCreatedData,
    OrganizationMembershipDeleted,
    OrganizationMembershipDeletedData,
    OrganizationMembershipUpdated,
    OrganizationMembershipUpdatedData,
    OrganizationRoleCreated,
    OrganizationRoleCreatedData,
    OrganizationRoleDeleted,
    OrganizationRoleDeletedData,
    OrganizationRoleUpdated,
    OrganizationRoleUpdatedData,
    OrganizationUpdated,
    OrganizationUpdatedData,
    OrganizationUpdatedDataDomain,
    PasswordResetCreated,
    PasswordResetCreatedData,
    PasswordResetSucceeded,
    PasswordResetSucceededData,
    PermissionCreated,
    PermissionCreatedData,
    PermissionDeleted,
    PermissionDeletedData,
    PermissionUpdated,
    PermissionUpdatedData,
    PipeConnectedAccount,
    PipesConnectedAccountConnected,
    PipesConnectedAccountConnectionFailed,
    PipesConnectedAccountConnectionFailedData,
    PipesConnectedAccountDisconnected,
    PipesConnectedAccountReauthorizationNeeded,
    RadarChallengeCreated,
    RadarChallengeCreatedData,
    RoleCreated,
    RoleCreatedData,
    RoleDeleted,
    RoleDeletedData,
    RoleUpdated,
    RoleUpdatedData,
    SessionCreated,
    SessionCreatedData,
    SessionCreatedDataImpersonator,
    SessionRevoked,
    SessionRevokedData,
    SessionRevokedDataImpersonator,
    UserApiKeyCreatedDataOwner,
    UserApiKeyRevokedDataOwner,
    UserApiKeyUpdatedDataOwner,
    UserCreated,
    UserDeleted,
    UserUpdated,
    VaultByokKeyDeleted,
    VaultByokKeyDeletedData,
    VaultByokKeyVerificationCompleted,
    VaultByokKeyVerificationCompletedData,
    VaultDataCreated,
    VaultDataCreatedData,
    VaultDataDeleted,
    VaultDataDeletedData,
    VaultDataRead,
    VaultDataReadData,
    VaultDataUpdated,
    VaultDataUpdatedData,
    VaultDekDecrypted,
    VaultDekDecryptedData,
    VaultDekRead,
    VaultDekReadData,
    VaultKekCreated,
    VaultKekCreatedData,
    VaultKekDeleted,
    VaultKekDeletedData,
    VaultMetadataRead,
    VaultMetadataReadData,
    VaultNamesListed,
    VaultNamesListedData,
    WaitlistUser,
    WaitlistUserApproved,
    WaitlistUserCreated,
    WaitlistUserDenied,
)


class TestModelRoundTrip:
    def test_error_response_round_trip(self):
        data = load_fixture("error_response.json")
        instance = ErrorResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ErrorResponse.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_error_response_minimal_payload(self):
        data = {"error": "Invalid request parameters."}
        instance = ErrorResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["error"] == data["error"]

    def test_connect_application_oauth_round_trip(self):
        data = load_fixture("connect_application_oauth.json")
        instance = ConnectApplicationOAuth.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectApplicationOAuth.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connect_application_oauth_minimal_payload(self):
        data = {
            "object": "connect_application",
            "id": "conn_app_01HXYZ123456789ABCDEFGHIJ",
            "client_id": "client_01HXYZ123456789ABCDEFGHIJ",
            "description": None,
            "name": "My Application",
            "scopes": ["openid", "profile", "email"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "application_type": "oauth",
            "redirect_uris": [{"uri": "https://example.com/callback", "default": True}],
            "uses_pkce": True,
            "is_first_party": True,
        }
        instance = ConnectApplicationOAuth.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["client_id"] == data["client_id"]
        assert serialized["description"] == data["description"]
        assert serialized["name"] == data["name"]
        assert serialized["scopes"] == data["scopes"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["application_type"] == data["application_type"]
        assert serialized["redirect_uris"] == data["redirect_uris"]
        assert serialized["uses_pkce"] == data["uses_pkce"]
        assert serialized["is_first_party"] == data["is_first_party"]

    def test_connect_application_oauth_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "connect_application",
            "id": "conn_app_01HXYZ123456789ABCDEFGHIJ",
            "client_id": "client_01HXYZ123456789ABCDEFGHIJ",
            "description": "An application for managing user access",
            "name": "My Application",
            "scopes": ["openid", "profile", "email"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "application_type": "oauth",
            "redirect_uris": [{"uri": "https://example.com/callback", "default": True}],
            "uses_pkce": True,
            "is_first_party": True,
        }
        instance = ConnectApplicationOAuth.from_dict(data)
        serialized = instance.to_dict()
        assert "was_dynamically_registered" not in serialized
        assert "organization_id" not in serialized

    def test_connect_application_oauth_preserves_nullable_fields(self):
        data = {
            "object": "connect_application",
            "id": "conn_app_01HXYZ123456789ABCDEFGHIJ",
            "client_id": "client_01HXYZ123456789ABCDEFGHIJ",
            "description": None,
            "name": "My Application",
            "scopes": ["openid", "profile", "email"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "application_type": "oauth",
            "redirect_uris": [{"uri": "https://example.com/callback", "default": True}],
            "uses_pkce": True,
            "is_first_party": True,
            "was_dynamically_registered": True,
            "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
        }
        instance = ConnectApplicationOAuth.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_connect_application_oauth_redirect_uris_round_trip(self):
        data = load_fixture("connect_application_oauth_redirect_uris.json")
        instance = ConnectApplicationOAuthRedirectUris.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectApplicationOAuthRedirectUris.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connect_application_oauth_redirect_uris_minimal_payload(self):
        data = {"uri": "https://example.com/callback", "default": True}
        instance = ConnectApplicationOAuthRedirectUris.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["uri"] == data["uri"]
        assert serialized["default"] == data["default"]

    def test_connect_application_m2m_round_trip(self):
        data = load_fixture("connect_application_m2m.json")
        instance = ConnectApplicationM2M.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectApplicationM2M.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connect_application_m2m_minimal_payload(self):
        data = {
            "object": "connect_application",
            "id": "conn_app_01HXYZ123456789ABCDEFGHIJ",
            "client_id": "client_01HXYZ123456789ABCDEFGHIJ",
            "description": None,
            "name": "My Application",
            "scopes": ["openid", "profile", "email"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "application_type": "m2m",
            "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
        }
        instance = ConnectApplicationM2M.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["client_id"] == data["client_id"]
        assert serialized["description"] == data["description"]
        assert serialized["name"] == data["name"]
        assert serialized["scopes"] == data["scopes"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["application_type"] == data["application_type"]
        assert serialized["organization_id"] == data["organization_id"]

    def test_connect_application_m2m_preserves_nullable_fields(self):
        data = {
            "object": "connect_application",
            "id": "conn_app_01HXYZ123456789ABCDEFGHIJ",
            "client_id": "client_01HXYZ123456789ABCDEFGHIJ",
            "description": None,
            "name": "My Application",
            "scopes": ["openid", "profile", "email"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "application_type": "m2m",
            "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
        }
        instance = ConnectApplicationM2M.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_event_context_actor_round_trip(self):
        data = load_fixture("event_context_actor.json")
        instance = EventContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = EventContextActor.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_event_context_actor_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = EventContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["source"] == data["source"]
        assert serialized["name"] == data["name"]

    def test_event_context_actor_preserves_nullable_fields(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = EventContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["name"] is None

    def test_event_context_actor_round_trips_unknown_enum_values(self):
        data = {
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "source": "unexpected_event_context_actor_source",
            "name": "Jane Doe",
        }
        instance = EventContextActor.from_dict(data)
        assert instance.to_dict() == data

    def test_event_context_round_trip(self):
        data = load_fixture("event_context.json")
        instance = EventContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = EventContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_event_context_minimal_payload(self):
        data = {}
        instance = EventContext.from_dict(data)
        assert instance.to_dict() is not None

    def test_event_context_omits_absent_optional_non_nullable_fields(self):
        data = {}
        instance = EventContext.from_dict(data)
        serialized = instance.to_dict()
        assert "google_analytics_client_id" not in serialized
        assert "google_analytics_sessions" not in serialized
        assert "ajs_anonymous_id" not in serialized
        assert "client_id" not in serialized
        assert "actor" not in serialized
        assert "previous_attributes" not in serialized

    def test_directory_user_round_trip(self):
        data = load_fixture("directory_user.json")
        instance = DirectoryUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DirectoryUser.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_directory_user_minimal_payload(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": None,
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DirectoryUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["idp_id"] == data["idp_id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["raw_attributes"] == data["raw_attributes"]
        assert serialized["custom_attributes"] == data["custom_attributes"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_directory_user_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": "marcelina.davis@example.com",
            "first_name": "Marcelina",
            "last_name": "Davis",
            "name": "Marcelina Davis",
            "job_title": "Software Engineer",
            "username": "mdavis",
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DirectoryUser.from_dict(data)
        serialized = instance.to_dict()
        assert "emails" not in serialized
        assert "role" not in serialized
        assert "roles" not in serialized

    def test_directory_user_preserves_nullable_fields(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": None,
            "first_name": None,
            "last_name": None,
            "name": None,
            "emails": [
                {
                    "primary": True,
                    "type": "work",
                    "value": "marcelina.davis@example.com",
                }
            ],
            "job_title": None,
            "username": None,
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DirectoryUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] is None
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None
        assert serialized["name"] is None
        assert serialized["job_title"] is None
        assert serialized["username"] is None

    def test_directory_user_round_trips_unknown_enum_values(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": "marcelina.davis@example.com",
            "first_name": "Marcelina",
            "last_name": "Davis",
            "name": "Marcelina Davis",
            "emails": [
                {
                    "primary": True,
                    "type": "work",
                    "value": "marcelina.davis@example.com",
                }
            ],
            "job_title": "Software Engineer",
            "username": "mdavis",
            "state": "unexpected_directory_user_state",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DirectoryUser.from_dict(data)
        assert instance.to_dict() == data

    def test_pipe_connected_account_round_trip(self):
        data = load_fixture("pipe_connected_account.json")
        instance = PipeConnectedAccount.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipeConnectedAccount.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipe_connected_account_minimal_payload(self):
        data = {
            "object": "connected_account",
            "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
            "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
            "provider_slug": "github",
            "user_id": None,
            "organization_id": None,
            "scopes": ["repo", "user:email"],
            "state": "connected",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipeConnectedAccount.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["data_integration_id"] == data["data_integration_id"]
        assert serialized["provider_slug"] == data["provider_slug"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["scopes"] == data["scopes"]
        assert serialized["state"] == data["state"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_pipe_connected_account_preserves_nullable_fields(self):
        data = {
            "object": "connected_account",
            "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
            "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
            "provider_slug": "github",
            "user_id": None,
            "organization_id": None,
            "scopes": ["repo", "user:email"],
            "state": "connected",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipeConnectedAccount.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["user_id"] is None
        assert serialized["organization_id"] is None

    def test_pipe_connected_account_round_trips_unknown_enum_values(self):
        data = {
            "object": "connected_account",
            "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
            "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
            "provider_slug": "github",
            "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "scopes": ["repo", "user:email"],
            "state": "unexpected_pipe_connected_account_state",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipeConnectedAccount.from_dict(data)
        assert instance.to_dict() == data

    def test_waitlist_user_round_trip(self):
        data = load_fixture("waitlist_user.json")
        instance = WaitlistUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = WaitlistUser.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_waitlist_user_minimal_payload(self):
        data = {
            "object": "waitlist_user",
            "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "approved_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["approved_at"] == data["approved_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_waitlist_user_preserves_nullable_fields(self):
        data = {
            "object": "waitlist_user",
            "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "approved_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["approved_at"] is None

    def test_waitlist_user_round_trips_unknown_enum_values(self):
        data = {
            "object": "waitlist_user",
            "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "unexpected_waitlist_user_state",
            "approved_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUser.from_dict(data)
        assert instance.to_dict() == data

    def test_action_authentication_denied_round_trip(self):
        data = load_fixture("action_authentication_denied.json")
        instance = ActionAuthenticationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ActionAuthenticationDenied.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_action_authentication_denied_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "action.authentication.denied",
            "data": {
                "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "authentication",
                "verdict": "Deny",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "email": "user@example.com",
                "ip_address": "203.0.113.1",
                "user_agent": "Mozilla/5.0",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ActionAuthenticationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_action_authentication_denied_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "action.authentication.denied",
            "data": {
                "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "authentication",
                "verdict": "Deny",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "email": "user@example.com",
                "ip_address": "203.0.113.1",
                "user_agent": "Mozilla/5.0",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ActionAuthenticationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_action_authentication_denied_data_round_trip(self):
        data = load_fixture("action_authentication_denied_data.json")
        instance = ActionAuthenticationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ActionAuthenticationDeniedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_action_authentication_denied_data_minimal_payload(self):
        data = {
            "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "authentication",
            "verdict": "Deny",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": None,
            "email": "user@example.com",
            "ip_address": None,
            "user_agent": None,
        }
        instance = ActionAuthenticationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["action_endpoint_id"] == data["action_endpoint_id"]
        assert serialized["action_execution_id"] == data["action_execution_id"]
        assert serialized["type"] == data["type"]
        assert serialized["verdict"] == data["verdict"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["email"] == data["email"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]

    def test_action_authentication_denied_data_preserves_nullable_fields(self):
        data = {
            "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "authentication",
            "verdict": "Deny",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": None,
            "email": "user@example.com",
            "ip_address": None,
            "user_agent": None,
        }
        instance = ActionAuthenticationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_action_user_registration_denied_round_trip(self):
        data = load_fixture("action_user_registration_denied.json")
        instance = ActionUserRegistrationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ActionUserRegistrationDenied.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_action_user_registration_denied_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "action.user_registration.denied",
            "data": {
                "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "user_registration",
                "verdict": "Deny",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "email": "user@example.com",
                "ip_address": "203.0.113.1",
                "user_agent": "Mozilla/5.0",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ActionUserRegistrationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_action_user_registration_denied_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "action.user_registration.denied",
            "data": {
                "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "user_registration",
                "verdict": "Deny",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "email": "user@example.com",
                "ip_address": "203.0.113.1",
                "user_agent": "Mozilla/5.0",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ActionUserRegistrationDenied.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_action_user_registration_denied_data_round_trip(self):
        data = load_fixture("action_user_registration_denied_data.json")
        instance = ActionUserRegistrationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ActionUserRegistrationDeniedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_action_user_registration_denied_data_minimal_payload(self):
        data = {
            "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "user_registration",
            "verdict": "Deny",
            "organization_id": None,
            "email": "user@example.com",
            "ip_address": None,
            "user_agent": None,
        }
        instance = ActionUserRegistrationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["action_endpoint_id"] == data["action_endpoint_id"]
        assert serialized["action_execution_id"] == data["action_execution_id"]
        assert serialized["type"] == data["type"]
        assert serialized["verdict"] == data["verdict"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["email"] == data["email"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]

    def test_action_user_registration_denied_data_preserves_nullable_fields(self):
        data = {
            "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "user_registration",
            "verdict": "Deny",
            "organization_id": None,
            "email": "user@example.com",
            "ip_address": None,
            "user_agent": None,
        }
        instance = ActionUserRegistrationDeniedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_agent_registration_claim_attempt_created_round_trip(self):
        data = load_fixture("agent_registration_claim_attempt_created.json")
        instance = AgentRegistrationClaimAttemptCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationClaimAttemptCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_claim_attempt_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.claim.attempt.created",
            "data": {
                "object": "agent_registration_claim_attempt",
                "id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_claim_id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "login_hint": "jane@example.com",
                "expires_at": "2024-01-15T10:35:00.000Z",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:30:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationClaimAttemptCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_claim_attempt_created_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.claim.attempt.created",
            "data": {
                "object": "agent_registration_claim_attempt",
                "id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_claim_id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "login_hint": "jane@example.com",
                "expires_at": "2024-01-15T10:35:00.000Z",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:30:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationClaimAttemptCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_claim_attempt_created_data_round_trip(self):
        data = load_fixture("agent_registration_claim_attempt_created_data.json")
        instance = AgentRegistrationClaimAttemptCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationClaimAttemptCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_claim_attempt_created_data_minimal_payload(self):
        data = {
            "object": "agent_registration_claim_attempt",
            "id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_registration_claim_id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "login_hint": "jane@example.com",
            "expires_at": "2024-01-15T10:35:00.000Z",
            "created_at": "2024-01-15T10:30:00.000Z",
            "updated_at": "2024-01-15T10:30:00.000Z",
        }
        instance = AgentRegistrationClaimAttemptCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["agent_registration_id"] == data["agent_registration_id"]
        assert (
            serialized["agent_registration_claim_id"]
            == data["agent_registration_claim_id"]
        )
        assert serialized["login_hint"] == data["login_hint"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_agent_registration_claim_completed_round_trip(self):
        data = load_fixture("agent_registration_claim_completed.json")
        instance = AgentRegistrationClaimCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationClaimCompleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_claim_completed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.claim.completed",
            "data": {
                "object": "agent_registration_claim",
                "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "claimed_by": {
                    "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": None,
                },
                "completed_at": "2024-01-15T10:32:00.000Z",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:32:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationClaimCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_claim_completed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.claim.completed",
            "data": {
                "object": "agent_registration_claim",
                "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "claimed_by": {
                    "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": None,
                },
                "completed_at": "2024-01-15T10:32:00.000Z",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:32:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationClaimCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_claim_completed_data_round_trip(self):
        data = load_fixture("agent_registration_claim_completed_data.json")
        instance = AgentRegistrationClaimCompletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationClaimCompletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_claim_completed_data_minimal_payload(self):
        data = {
            "object": "agent_registration_claim",
            "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "claimed_by": {
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": None,
            },
            "completed_at": "2024-01-15T10:32:00.000Z",
            "created_at": "2024-01-15T10:30:00.000Z",
            "updated_at": "2024-01-15T10:32:00.000Z",
        }
        instance = AgentRegistrationClaimCompletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["agent_registration_id"] == data["agent_registration_id"]
        assert serialized["completed_by_attempt_id"] == data["completed_by_attempt_id"]
        assert serialized["claimed_by"] == data["claimed_by"]
        assert serialized["completed_at"] == data["completed_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_agent_registration_claim_completed_data_claimed_by_round_trip(self):
        data = load_fixture("agent_registration_claim_completed_data_claimed_by.json")
        instance = AgentRegistrationClaimCompletedDataClaimedBy.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationClaimCompletedDataClaimedBy.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_claim_completed_data_claimed_by_minimal_payload(self):
        data = {"user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": None}
        instance = AgentRegistrationClaimCompletedDataClaimedBy.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]

    def test_agent_registration_created_round_trip(self):
        data = load_fixture("agent_registration_created.json")
        instance = AgentRegistrationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.created",
            "data": {
                "object": "agent_registration",
                "id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_identity": {
                    "object": "agent_identity",
                    "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "userland_user_id": None,
                },
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "unverified",
                "kind": "anonymous",
                "method": "anonymous",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:30:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.created",
            "data": {
                "object": "agent_registration",
                "id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_identity": {
                    "object": "agent_identity",
                    "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "userland_user_id": None,
                },
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "unverified",
                "kind": "anonymous",
                "method": "anonymous",
                "created_at": "2024-01-15T10:30:00.000Z",
                "updated_at": "2024-01-15T10:30:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_created_data_round_trip(self):
        data = load_fixture("agent_registration_created_data.json")
        instance = AgentRegistrationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_created_data_minimal_payload(self):
        data = {
            "object": "agent_registration",
            "id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_identity": {
                "object": "agent_identity",
                "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "userland_user_id": None,
            },
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "unverified",
            "kind": "anonymous",
            "method": "anonymous",
            "created_at": "2024-01-15T10:30:00.000Z",
            "updated_at": "2024-01-15T10:30:00.000Z",
        }
        instance = AgentRegistrationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["agent_identity"] == data["agent_identity"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["status"] == data["status"]
        assert serialized["kind"] == data["kind"]
        assert serialized["method"] == data["method"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_agent_registration_created_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "agent_registration",
            "id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_identity": {
                "object": "agent_identity",
                "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "userland_user_id": None,
            },
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "unexpected_agent_registration_created_data_status",
            "kind": "anonymous",
            "method": "anonymous",
            "created_at": "2024-01-15T10:30:00.000Z",
            "updated_at": "2024-01-15T10:30:00.000Z",
        }
        instance = AgentRegistrationCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_agent_registration_created_data_agent_identity_round_trip(self):
        data = load_fixture("agent_registration_created_data_agent_identity.json")
        instance = AgentRegistrationCreatedDataAgentIdentity.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCreatedDataAgentIdentity.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_created_data_agent_identity_minimal_payload(self):
        data = {
            "object": "agent_identity",
            "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "userland_user_id": None,
        }
        instance = AgentRegistrationCreatedDataAgentIdentity.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["userland_user_id"] == data["userland_user_id"]

    def test_agent_registration_credential_issued_round_trip(self):
        data = load_fixture("agent_registration_credential_issued.json")
        instance = AgentRegistrationCredentialIssued.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCredentialIssued.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_credential_issued_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.credential.issued",
            "data": {
                "object": "agent_registration_credential",
                "id": "agent_reg_credential_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "detail": {
                    "kind": "api_key",
                    "api_key_id": "api_key_01HWDP91J37GZW2FT9GCEX8YWV",
                },
                "created_at": "2024-01-15T10:33:00.000Z",
                "updated_at": "2024-01-15T10:33:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationCredentialIssued.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_credential_issued_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.credential.issued",
            "data": {
                "object": "agent_registration_credential",
                "id": "agent_reg_credential_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "detail": {
                    "kind": "api_key",
                    "api_key_id": "api_key_01HWDP91J37GZW2FT9GCEX8YWV",
                },
                "created_at": "2024-01-15T10:33:00.000Z",
                "updated_at": "2024-01-15T10:33:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationCredentialIssued.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_credential_issued_data_round_trip(self):
        data = load_fixture("agent_registration_credential_issued_data.json")
        instance = AgentRegistrationCredentialIssuedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCredentialIssuedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_credential_issued_data_minimal_payload(self):
        data = {
            "object": "agent_registration_credential",
            "id": "agent_reg_credential_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "detail": {
                "kind": "api_key",
                "api_key_id": "api_key_01HWDP91J37GZW2FT9GCEX8YWV",
            },
            "created_at": "2024-01-15T10:33:00.000Z",
            "updated_at": "2024-01-15T10:33:00.000Z",
        }
        instance = AgentRegistrationCredentialIssuedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["agent_registration_id"] == data["agent_registration_id"]
        assert serialized["detail"] == data["detail"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_agent_registration_credential_issued_data_detail_round_trip(self):
        data = load_fixture("agent_registration_credential_issued_data_detail.json")
        instance = AgentRegistrationCredentialIssuedDataDetail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationCredentialIssuedDataDetail.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_credential_issued_data_detail_minimal_payload(self):
        data = {"kind": "api_key", "api_key_id": "api_key_01HWDP91J37GZW2FT9GCEX8YWV"}
        instance = AgentRegistrationCredentialIssuedDataDetail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["kind"] == data["kind"]
        assert serialized["api_key_id"] == data["api_key_id"]

    def test_access_token_agent_registration_credential_issued_data_detail_round_trip(
        self,
    ):
        data = load_fixture(
            "access_token_agent_registration_credential_issued_data_detail.json"
        )
        instance = AccessTokenAgentRegistrationCredentialIssuedDataDetail.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = AccessTokenAgentRegistrationCredentialIssuedDataDetail.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_access_token_agent_registration_credential_issued_data_detail_minimal_payload(
        self,
    ):
        data = {
            "kind": "access_token",
            "jti": "jti_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "expires_at": "2024-01-15T11:30:00.000Z",
        }
        instance = AccessTokenAgentRegistrationCredentialIssuedDataDetail.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["kind"] == data["kind"]
        assert serialized["jti"] == data["jti"]
        assert serialized["expires_at"] == data["expires_at"]

    def test_agent_registration_deleted_round_trip(self):
        data = load_fixture("agent_registration_deleted.json")
        instance = AgentRegistrationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.deleted",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.deleted",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_deleted_data_round_trip(self):
        data = load_fixture("agent_registration_deleted_data.json")
        instance = AgentRegistrationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_deleted_data_minimal_payload(self):
        data = {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = AgentRegistrationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["agent_registration_id"] == data["agent_registration_id"]

    def test_agent_registration_expired_round_trip(self):
        data = load_fixture("agent_registration_expired.json")
        instance = AgentRegistrationExpired.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationExpired.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_expired_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.expired",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationExpired.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_expired_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.expired",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationExpired.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_expired_data_round_trip(self):
        data = load_fixture("agent_registration_expired_data.json")
        instance = AgentRegistrationExpiredData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationExpiredData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_expired_data_minimal_payload(self):
        data = {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = AgentRegistrationExpiredData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["agent_registration_id"] == data["agent_registration_id"]

    def test_agent_registration_organization_switched_round_trip(self):
        data = load_fixture("agent_registration_organization_switched.json")
        instance = AgentRegistrationOrganizationSwitched.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationOrganizationSwitched.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_organization_switched_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.organization.switched",
            "data": {
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "from_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "to_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNZ",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationOrganizationSwitched.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_organization_switched_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.organization.switched",
            "data": {
                "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "from_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "to_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNZ",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationOrganizationSwitched.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_organization_switched_data_round_trip(self):
        data = load_fixture("agent_registration_organization_switched_data.json")
        instance = AgentRegistrationOrganizationSwitchedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationOrganizationSwitchedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_organization_switched_data_minimal_payload(self):
        data = {
            "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "from_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "to_organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNZ",
        }
        instance = AgentRegistrationOrganizationSwitchedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["agent_registration_id"] == data["agent_registration_id"]
        assert serialized["from_organization_id"] == data["from_organization_id"]
        assert serialized["to_organization_id"] == data["to_organization_id"]

    def test_agent_registration_revoked_round_trip(self):
        data = load_fixture("agent_registration_revoked.json")
        instance = AgentRegistrationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationRevoked.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_revoked_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.revoked",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_agent_registration_revoked_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "agent.registration.revoked",
            "data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AgentRegistrationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_agent_registration_revoked_data_round_trip(self):
        data = load_fixture("agent_registration_revoked_data.json")
        instance = AgentRegistrationRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AgentRegistrationRevokedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_agent_registration_revoked_data_minimal_payload(self):
        data = {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = AgentRegistrationRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["agent_registration_id"] == data["agent_registration_id"]

    def test_api_key_created_round_trip(self):
        data = load_fixture("api_key_created.json")
        instance = ApiKeyCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.created",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_api_key_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.created",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_api_key_created_data_round_trip(self):
        data = load_fixture("api_key_created_data.json")
        instance = ApiKeyCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_created_data_minimal_payload(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["owner"] == data["owner"]
        assert serialized["name"] == data["name"]
        assert serialized["obfuscated_value"] == data["obfuscated_value"]
        assert serialized["last_used_at"] == data["last_used_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_api_key_created_data_preserves_nullable_fields(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["last_used_at"] is None
        assert serialized["expires_at"] is None

    def test_api_key_created_data_owner_round_trip(self):
        data = load_fixture("api_key_created_data_owner.json")
        instance = ApiKeyCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyCreatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_created_data_owner_minimal_payload(self):
        data = {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ApiKeyCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]

    def test_user_api_key_created_data_owner_round_trip(self):
        data = load_fixture("user_api_key_created_data_owner.json")
        instance = UserApiKeyCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserApiKeyCreatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_api_key_created_data_owner_minimal_payload(self):
        data = {
            "type": "user",
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = UserApiKeyCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]

    def test_api_key_revoked_round_trip(self):
        data = load_fixture("api_key_revoked.json")
        instance = ApiKeyRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyRevoked.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_revoked_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.revoked",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_api_key_revoked_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.revoked",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_api_key_revoked_data_round_trip(self):
        data = load_fixture("api_key_revoked_data.json")
        instance = ApiKeyRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyRevokedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_revoked_data_minimal_payload(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["owner"] == data["owner"]
        assert serialized["name"] == data["name"]
        assert serialized["obfuscated_value"] == data["obfuscated_value"]
        assert serialized["last_used_at"] == data["last_used_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_api_key_revoked_data_preserves_nullable_fields(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["last_used_at"] is None
        assert serialized["expires_at"] is None

    def test_api_key_revoked_data_owner_round_trip(self):
        data = load_fixture("api_key_revoked_data_owner.json")
        instance = ApiKeyRevokedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyRevokedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_revoked_data_owner_minimal_payload(self):
        data = {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ApiKeyRevokedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]

    def test_user_api_key_revoked_data_owner_round_trip(self):
        data = load_fixture("user_api_key_revoked_data_owner.json")
        instance = UserApiKeyRevokedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserApiKeyRevokedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_api_key_revoked_data_owner_minimal_payload(self):
        data = {
            "type": "user",
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = UserApiKeyRevokedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]

    def test_api_key_updated_round_trip(self):
        data = load_fixture("api_key_updated.json")
        instance = ApiKeyUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.updated",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"expires_at": None},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_api_key_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "api_key.updated",
            "data": {
                "object": "api_key",
                "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "owner": {
                    "type": "organization",
                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "name": "My API Key",
                "obfuscated_value": "sk_test_...1234",
                "last_used_at": "2026-01-15T12:00:00.000Z",
                "expires_at": None,
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"expires_at": None},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ApiKeyUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_api_key_updated_data_round_trip(self):
        data = load_fixture("api_key_updated_data.json")
        instance = ApiKeyUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_updated_data_minimal_payload(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "previous_attributes": {"expires_at": None},
        }
        instance = ApiKeyUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["owner"] == data["owner"]
        assert serialized["name"] == data["name"]
        assert serialized["obfuscated_value"] == data["obfuscated_value"]
        assert serialized["last_used_at"] == data["last_used_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["previous_attributes"] == data["previous_attributes"]

    def test_api_key_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "api_key",
            "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"},
            "name": "My API Key",
            "obfuscated_value": "sk_test_...1234",
            "last_used_at": None,
            "expires_at": None,
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "previous_attributes": {"expires_at": None},
        }
        instance = ApiKeyUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["last_used_at"] is None
        assert serialized["expires_at"] is None

    def test_api_key_updated_data_owner_round_trip(self):
        data = load_fixture("api_key_updated_data_owner.json")
        instance = ApiKeyUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyUpdatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_updated_data_owner_minimal_payload(self):
        data = {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ApiKeyUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]

    def test_user_api_key_updated_data_owner_round_trip(self):
        data = load_fixture("user_api_key_updated_data_owner.json")
        instance = UserApiKeyUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserApiKeyUpdatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_api_key_updated_data_owner_minimal_payload(self):
        data = {
            "type": "user",
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = UserApiKeyUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]

    def test_api_key_updated_data_previous_attribute_round_trip(self):
        data = load_fixture("api_key_updated_data_previous_attribute.json")
        instance = ApiKeyUpdatedDataPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ApiKeyUpdatedDataPreviousAttribute.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_api_key_updated_data_previous_attribute_minimal_payload(self):
        data = {"expires_at": None}
        instance = ApiKeyUpdatedDataPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["expires_at"] == data["expires_at"]

    def test_api_key_updated_data_previous_attribute_preserves_nullable_fields(self):
        data = {"expires_at": None}
        instance = ApiKeyUpdatedDataPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["expires_at"] is None

    def test_authentication_email_verification_failed_round_trip(self):
        data = load_fixture("authentication_email_verification_failed.json")
        instance = AuthenticationEmailVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationEmailVerificationFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_email_verification_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.email_verification_failed",
            "data": {
                "type": "email_verification",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationEmailVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_email_verification_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.email_verification_failed",
            "data": {
                "type": "email_verification",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationEmailVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_email_verification_failed_data_round_trip(self):
        data = load_fixture("authentication_email_verification_failed_data.json")
        instance = AuthenticationEmailVerificationFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationEmailVerificationFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_email_verification_failed_data_minimal_payload(self):
        data = {
            "type": "email_verification",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationEmailVerificationFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_email_verification_failed_data_preserves_nullable_fields(
        self,
    ):
        data = {
            "type": "email_verification",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationEmailVerificationFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_email_verification_failed_data_error_round_trip(self):
        data = load_fixture("authentication_email_verification_failed_data_error.json")
        instance = AuthenticationEmailVerificationFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationEmailVerificationFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_email_verification_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationEmailVerificationFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_email_verification_succeeded_round_trip(self):
        data = load_fixture("authentication_email_verification_succeeded.json")
        instance = AuthenticationEmailVerificationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationEmailVerificationSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_email_verification_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.email_verification_succeeded",
            "data": {
                "type": "email_verification",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationEmailVerificationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_email_verification_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.email_verification_succeeded",
            "data": {
                "type": "email_verification",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationEmailVerificationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_email_verification_succeeded_data_round_trip(self):
        data = load_fixture("authentication_email_verification_succeeded_data.json")
        instance = AuthenticationEmailVerificationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationEmailVerificationSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_email_verification_succeeded_data_minimal_payload(self):
        data = {
            "type": "email_verification",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationEmailVerificationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_email_verification_succeeded_data_preserves_nullable_fields(
        self,
    ):
        data = {
            "type": "email_verification",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationEmailVerificationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_magic_auth_failed_round_trip(self):
        data = load_fixture("authentication_magic_auth_failed.json")
        instance = AuthenticationMagicAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMagicAuthFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_magic_auth_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.magic_auth_failed",
            "data": {
                "type": "magic_auth",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMagicAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_magic_auth_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.magic_auth_failed",
            "data": {
                "type": "magic_auth",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMagicAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_magic_auth_failed_data_round_trip(self):
        data = load_fixture("authentication_magic_auth_failed_data.json")
        instance = AuthenticationMagicAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMagicAuthFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_magic_auth_failed_data_minimal_payload(self):
        data = {
            "type": "magic_auth",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationMagicAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_magic_auth_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "magic_auth",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationMagicAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_magic_auth_failed_data_error_round_trip(self):
        data = load_fixture("authentication_magic_auth_failed_data_error.json")
        instance = AuthenticationMagicAuthFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMagicAuthFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_magic_auth_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationMagicAuthFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_magic_auth_succeeded_round_trip(self):
        data = load_fixture("authentication_magic_auth_succeeded.json")
        instance = AuthenticationMagicAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMagicAuthSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_magic_auth_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.magic_auth_succeeded",
            "data": {
                "type": "magic_auth",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMagicAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_magic_auth_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.magic_auth_succeeded",
            "data": {
                "type": "magic_auth",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMagicAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_magic_auth_succeeded_data_round_trip(self):
        data = load_fixture("authentication_magic_auth_succeeded_data.json")
        instance = AuthenticationMagicAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMagicAuthSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_magic_auth_succeeded_data_minimal_payload(self):
        data = {
            "type": "magic_auth",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationMagicAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_magic_auth_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "magic_auth",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationMagicAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_mfa_failed_round_trip(self):
        data = load_fixture("authentication_mfa_failed.json")
        instance = AuthenticationMFAFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMFAFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_mfa_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.mfa_failed",
            "data": {
                "type": "mfa",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMFAFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_mfa_failed_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.mfa_failed",
            "data": {
                "type": "mfa",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMFAFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_mfa_failed_data_round_trip(self):
        data = load_fixture("authentication_mfa_failed_data.json")
        instance = AuthenticationMFAFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMFAFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_mfa_failed_data_minimal_payload(self):
        data = {
            "type": "mfa",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationMFAFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_mfa_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "mfa",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationMFAFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_mfa_failed_data_error_round_trip(self):
        data = load_fixture("authentication_mfa_failed_data_error.json")
        instance = AuthenticationMFAFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMFAFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_mfa_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationMFAFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_mfa_succeeded_round_trip(self):
        data = load_fixture("authentication_mfa_succeeded.json")
        instance = AuthenticationMFASucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMFASucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_mfa_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.mfa_succeeded",
            "data": {
                "type": "mfa",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMFASucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_mfa_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.mfa_succeeded",
            "data": {
                "type": "mfa",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationMFASucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_mfa_succeeded_data_round_trip(self):
        data = load_fixture("authentication_mfa_succeeded_data.json")
        instance = AuthenticationMFASucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationMFASucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_mfa_succeeded_data_minimal_payload(self):
        data = {
            "type": "mfa",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationMFASucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_mfa_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "mfa",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationMFASucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_oauth_failed_round_trip(self):
        data = load_fixture("authentication_oauth_failed.json")
        instance = AuthenticationOAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationOAuthFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_oauth_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.oauth_failed",
            "data": {
                "type": "oauth",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationOAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_oauth_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.oauth_failed",
            "data": {
                "type": "oauth",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationOAuthFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_oauth_failed_data_round_trip(self):
        data = load_fixture("authentication_oauth_failed_data.json")
        instance = AuthenticationOAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationOAuthFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_oauth_failed_data_minimal_payload(self):
        data = {
            "type": "oauth",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationOAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_oauth_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "oauth",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationOAuthFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_oauth_failed_data_error_round_trip(self):
        data = load_fixture("authentication_oauth_failed_data_error.json")
        instance = AuthenticationOAuthFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationOAuthFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_oauth_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationOAuthFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_oauth_succeeded_round_trip(self):
        data = load_fixture("authentication_oauth_succeeded.json")
        instance = AuthenticationOAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationOAuthSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_oauth_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.oauth_succeeded",
            "data": {
                "type": "oauth",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationOAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_oauth_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.oauth_succeeded",
            "data": {
                "type": "oauth",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationOAuthSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_oauth_succeeded_data_round_trip(self):
        data = load_fixture("authentication_oauth_succeeded_data.json")
        instance = AuthenticationOAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationOAuthSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_oauth_succeeded_data_minimal_payload(self):
        data = {
            "type": "oauth",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": "user@example.com",
        }
        instance = AuthenticationOAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_oauth_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "oauth",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": "user@example.com",
        }
        instance = AuthenticationOAuthSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None

    def test_authentication_passkey_failed_round_trip(self):
        data = load_fixture("authentication_passkey_failed.json")
        instance = AuthenticationPasskeyFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasskeyFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_passkey_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.passkey_failed",
            "data": {
                "type": "passkey",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasskeyFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_passkey_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.passkey_failed",
            "data": {
                "type": "passkey",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasskeyFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_passkey_failed_data_round_trip(self):
        data = load_fixture("authentication_passkey_failed_data.json")
        instance = AuthenticationPasskeyFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasskeyFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_passkey_failed_data_minimal_payload(self):
        data = {
            "type": "passkey",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationPasskeyFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_passkey_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "passkey",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationPasskeyFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_passkey_failed_data_error_round_trip(self):
        data = load_fixture("authentication_passkey_failed_data_error.json")
        instance = AuthenticationPasskeyFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasskeyFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_passkey_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationPasskeyFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_passkey_succeeded_round_trip(self):
        data = load_fixture("authentication_passkey_succeeded.json")
        instance = AuthenticationPasskeySucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasskeySucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_passkey_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.passkey_succeeded",
            "data": {
                "type": "passkey",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasskeySucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_passkey_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.passkey_succeeded",
            "data": {
                "type": "passkey",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasskeySucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_passkey_succeeded_data_round_trip(self):
        data = load_fixture("authentication_passkey_succeeded_data.json")
        instance = AuthenticationPasskeySucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasskeySucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_passkey_succeeded_data_minimal_payload(self):
        data = {
            "type": "passkey",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationPasskeySucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_passkey_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "passkey",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationPasskeySucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_password_failed_round_trip(self):
        data = load_fixture("authentication_password_failed.json")
        instance = AuthenticationPasswordFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasswordFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_password_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.password_failed",
            "data": {
                "type": "password",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasswordFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_password_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.password_failed",
            "data": {
                "type": "password",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasswordFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_password_failed_data_round_trip(self):
        data = load_fixture("authentication_password_failed_data.json")
        instance = AuthenticationPasswordFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasswordFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_password_failed_data_minimal_payload(self):
        data = {
            "type": "password",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationPasswordFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["error"] == data["error"]

    def test_authentication_password_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "password",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationPasswordFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_password_failed_data_error_round_trip(self):
        data = load_fixture("authentication_password_failed_data_error.json")
        instance = AuthenticationPasswordFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasswordFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_password_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationPasswordFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_password_succeeded_round_trip(self):
        data = load_fixture("authentication_password_succeeded.json")
        instance = AuthenticationPasswordSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasswordSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_password_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.password_succeeded",
            "data": {
                "type": "password",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasswordSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_password_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.password_succeeded",
            "data": {
                "type": "password",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationPasswordSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_password_succeeded_data_round_trip(self):
        data = load_fixture("authentication_password_succeeded_data.json")
        instance = AuthenticationPasswordSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationPasswordSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_password_succeeded_data_minimal_payload(self):
        data = {
            "type": "password",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationPasswordSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_password_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "password",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationPasswordSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_radar_risk_detected_round_trip(self):
        data = load_fixture("authentication_radar_risk_detected.json")
        instance = AuthenticationRadarRiskDetected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationRadarRiskDetected.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_radar_risk_detected_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.radar_risk_detected",
            "data": {
                "auth_method": "password",
                "action": "signup",
                "control": "block",
                "blocklist_type": "ip",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationRadarRiskDetected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_radar_risk_detected_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.radar_risk_detected",
            "data": {
                "auth_method": "password",
                "action": "signup",
                "control": "block",
                "blocklist_type": "ip",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationRadarRiskDetected.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_radar_risk_detected_data_round_trip(self):
        data = load_fixture("authentication_radar_risk_detected_data.json")
        instance = AuthenticationRadarRiskDetectedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationRadarRiskDetectedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_radar_risk_detected_data_minimal_payload(self):
        data = {
            "auth_method": "password",
            "action": "signup",
            "control": None,
            "blocklist_type": None,
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationRadarRiskDetectedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["auth_method"] == data["auth_method"]
        assert serialized["action"] == data["action"]
        assert serialized["control"] == data["control"]
        assert serialized["blocklist_type"] == data["blocklist_type"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_radar_risk_detected_data_preserves_nullable_fields(self):
        data = {
            "auth_method": "password",
            "action": "signup",
            "control": None,
            "blocklist_type": None,
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationRadarRiskDetectedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["control"] is None
        assert serialized["blocklist_type"] is None
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_radar_risk_detected_data_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "auth_method": "password",
            "action": "unexpected_authentication_radar_risk_detected_data_action",
            "control": "block",
            "blocklist_type": "ip",
            "ip_address": "203.0.113.42",
            "user_agent": "Mozilla/5.0",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationRadarRiskDetectedData.from_dict(data)
        assert instance.to_dict() == data

    def test_authentication_reauthentication_succeeded_round_trip(self):
        data = load_fixture("authentication_reauthentication_succeeded.json")
        instance = AuthenticationReauthenticationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationReauthenticationSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_reauthentication_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.reauthentication_succeeded",
            "data": {
                "type": "reauthentication",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationReauthenticationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_reauthentication_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.reauthentication_succeeded",
            "data": {
                "type": "reauthentication",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationReauthenticationSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_reauthentication_succeeded_data_round_trip(self):
        data = load_fixture("authentication_reauthentication_succeeded_data.json")
        instance = AuthenticationReauthenticationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationReauthenticationSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_reauthentication_succeeded_data_minimal_payload(self):
        data = {
            "type": "reauthentication",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationReauthenticationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_authentication_reauthentication_succeeded_data_preserves_nullable_fields(
        self,
    ):
        data = {
            "type": "reauthentication",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = AuthenticationReauthenticationSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None

    def test_authentication_sso_failed_round_trip(self):
        data = load_fixture("authentication_sso_failed.json")
        instance = AuthenticationSSOFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_failed",
            "data": {
                "type": "sso",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_sso_failed_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_failed",
            "data": {
                "type": "sso",
                "status": "failed",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_sso_failed_data_round_trip(self):
        data = load_fixture("authentication_sso_failed_data.json")
        instance = AuthenticationSSOFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_failed_data_minimal_payload(self):
        data = {
            "type": "sso",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationSSOFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["sso"] == data["sso"]
        assert serialized["error"] == data["error"]

    def test_authentication_sso_failed_data_preserves_nullable_fields(self):
        data = {
            "type": "sso",
            "status": "failed",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationSSOFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_sso_failed_data_sso_round_trip(self):
        data = load_fixture("authentication_sso_failed_data_sso.json")
        instance = AuthenticationSSOFailedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOFailedDataSSO.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_failed_data_sso_minimal_payload(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOFailedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["connection_id"] == data["connection_id"]
        assert serialized["session_id"] == data["session_id"]

    def test_authentication_sso_failed_data_sso_preserves_nullable_fields(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOFailedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["connection_id"] is None
        assert serialized["session_id"] is None

    def test_authentication_sso_failed_data_error_round_trip(self):
        data = load_fixture("authentication_sso_failed_data_error.json")
        instance = AuthenticationSSOFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOFailedDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_failed_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationSSOFailedDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_authentication_sso_started_round_trip(self):
        data = load_fixture("authentication_sso_started.json")
        instance = AuthenticationSSOStarted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOStarted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_started_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_started",
            "data": {
                "type": "sso",
                "status": "started",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOStarted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_sso_started_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_started",
            "data": {
                "type": "sso",
                "status": "started",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOStarted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_sso_started_data_round_trip(self):
        data = load_fixture("authentication_sso_started_data.json")
        instance = AuthenticationSSOStartedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOStartedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_started_data_minimal_payload(self):
        data = {
            "type": "sso",
            "status": "started",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
        }
        instance = AuthenticationSSOStartedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["sso"] == data["sso"]

    def test_authentication_sso_started_data_preserves_nullable_fields(self):
        data = {
            "type": "sso",
            "status": "started",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
        }
        instance = AuthenticationSSOStartedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_sso_started_data_sso_round_trip(self):
        data = load_fixture("authentication_sso_started_data_sso.json")
        instance = AuthenticationSSOStartedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOStartedDataSSO.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_started_data_sso_minimal_payload(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOStartedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["connection_id"] == data["connection_id"]
        assert serialized["session_id"] == data["session_id"]

    def test_authentication_sso_started_data_sso_preserves_nullable_fields(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOStartedDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["connection_id"] is None
        assert serialized["session_id"] is None

    def test_authentication_sso_succeeded_round_trip(self):
        data = load_fixture("authentication_sso_succeeded.json")
        instance = AuthenticationSSOSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_succeeded",
            "data": {
                "type": "sso",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_sso_succeeded_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_succeeded",
            "data": {
                "type": "sso",
                "status": "succeeded",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_sso_succeeded_data_round_trip(self):
        data = load_fixture("authentication_sso_succeeded_data.json")
        instance = AuthenticationSSOSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_succeeded_data_minimal_payload(self):
        data = {
            "type": "sso",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": "user@example.com",
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
        }
        instance = AuthenticationSSOSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["sso"] == data["sso"]

    def test_authentication_sso_succeeded_data_preserves_nullable_fields(self):
        data = {
            "type": "sso",
            "status": "succeeded",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": "user@example.com",
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
        }
        instance = AuthenticationSSOSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None

    def test_authentication_sso_succeeded_data_sso_round_trip(self):
        data = load_fixture("authentication_sso_succeeded_data_sso.json")
        instance = AuthenticationSSOSucceededDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOSucceededDataSSO.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_succeeded_data_sso_minimal_payload(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOSucceededDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["connection_id"] == data["connection_id"]
        assert serialized["session_id"] == data["session_id"]

    def test_authentication_sso_succeeded_data_sso_preserves_nullable_fields(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOSucceededDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["connection_id"] is None
        assert serialized["session_id"] is None

    def test_authentication_sso_timed_out_round_trip(self):
        data = load_fixture("authentication_sso_timed_out.json")
        instance = AuthenticationSSOTimedOut.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOTimedOut.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_timed_out_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_timed_out",
            "data": {
                "type": "sso",
                "status": "timed_out",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOTimedOut.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_authentication_sso_timed_out_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "authentication.sso_timed_out",
            "data": {
                "type": "sso",
                "status": "timed_out",
                "ip_address": "203.0.113.42",
                "user_agent": "Mozilla/5.0",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
                "sso": {
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                    "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
                },
                "error": {
                    "code": "mfa_challenge_failed",
                    "message": "The MFA challenge has failed.",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = AuthenticationSSOTimedOut.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_authentication_sso_timed_out_data_round_trip(self):
        data = load_fixture("authentication_sso_timed_out_data.json")
        instance = AuthenticationSSOTimedOutData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOTimedOutData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_timed_out_data_minimal_payload(self):
        data = {
            "type": "sso",
            "status": "timed_out",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationSSOTimedOutData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["status"] == data["status"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["sso"] == data["sso"]
        assert serialized["error"] == data["error"]

    def test_authentication_sso_timed_out_data_preserves_nullable_fields(self):
        data = {
            "type": "sso",
            "status": "timed_out",
            "ip_address": None,
            "user_agent": None,
            "user_id": None,
            "email": None,
            "sso": {
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5",
                "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5",
            },
            "error": {
                "code": "mfa_challenge_failed",
                "message": "The MFA challenge has failed.",
            },
        }
        instance = AuthenticationSSOTimedOutData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["user_id"] is None
        assert serialized["email"] is None

    def test_authentication_sso_timed_out_data_sso_round_trip(self):
        data = load_fixture("authentication_sso_timed_out_data_sso.json")
        instance = AuthenticationSSOTimedOutDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOTimedOutDataSSO.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_timed_out_data_sso_minimal_payload(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOTimedOutDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["connection_id"] == data["connection_id"]
        assert serialized["session_id"] == data["session_id"]

    def test_authentication_sso_timed_out_data_sso_preserves_nullable_fields(self):
        data = {"organization_id": None, "connection_id": None, "session_id": None}
        instance = AuthenticationSSOTimedOutDataSSO.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] is None
        assert serialized["connection_id"] is None
        assert serialized["session_id"] is None

    def test_authentication_sso_timed_out_data_error_round_trip(self):
        data = load_fixture("authentication_sso_timed_out_data_error.json")
        instance = AuthenticationSSOTimedOutDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthenticationSSOTimedOutDataError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_authentication_sso_timed_out_data_error_minimal_payload(self):
        data = {
            "code": "mfa_challenge_failed",
            "message": "The MFA challenge has failed.",
        }
        instance = AuthenticationSSOTimedOutDataError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_connection_activated_round_trip(self):
        data = load_fixture("connection_activated.json")
        instance = ConnectionActivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionActivated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_activated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.activated",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "linked",
                "domains": [
                    {
                        "object": "connection_domain",
                        "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionActivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_connection_activated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.activated",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "linked",
                "domains": [
                    {
                        "object": "connection_domain",
                        "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionActivated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_connection_activated_data_round_trip(self):
        data = load_fixture("connection_activated_data.json")
        instance = ConnectionActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionActivatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_activated_data_minimal_payload(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["state"] == data["state"]
        assert serialized["name"] == data["name"]
        assert serialized["connection_type"] == data["connection_type"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["external_key"] == data["external_key"]
        assert serialized["status"] == data["status"]
        assert serialized["domains"] == data["domains"]

    def test_connection_activated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_connection_activated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "unexpected_connection_activated_data_state",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionActivatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_connection_activated_data_domain_round_trip(self):
        data = load_fixture("connection_activated_data_domain.json")
        instance = ConnectionActivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionActivatedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_activated_data_domain_minimal_payload(self):
        data = {
            "object": "connection_domain",
            "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domain": "acme.com",
        }
        instance = ConnectionActivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["domain"] == data["domain"]

    def test_connection_deactivated_round_trip(self):
        data = load_fixture("connection_deactivated.json")
        instance = ConnectionDeactivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionDeactivated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_deactivated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.deactivated",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "linked",
                "domains": [
                    {
                        "object": "connection_domain",
                        "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeactivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_connection_deactivated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.deactivated",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "linked",
                "domains": [
                    {
                        "object": "connection_domain",
                        "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeactivated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_connection_deactivated_data_round_trip(self):
        data = load_fixture("connection_deactivated_data.json")
        instance = ConnectionDeactivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionDeactivatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_deactivated_data_minimal_payload(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionDeactivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["state"] == data["state"]
        assert serialized["name"] == data["name"]
        assert serialized["connection_type"] == data["connection_type"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["external_key"] == data["external_key"]
        assert serialized["status"] == data["status"]
        assert serialized["domains"] == data["domains"]

    def test_connection_deactivated_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionDeactivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_connection_deactivated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "unexpected_connection_deactivated_data_state",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "linked",
            "domains": [
                {
                    "object": "connection_domain",
                    "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = ConnectionDeactivatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_connection_deactivated_data_domain_round_trip(self):
        data = load_fixture("connection_deactivated_data_domain.json")
        instance = ConnectionDeactivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionDeactivatedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_deactivated_data_domain_minimal_payload(self):
        data = {
            "object": "connection_domain",
            "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domain": "acme.com",
        }
        instance = ConnectionDeactivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["domain"] == data["domain"]

    def test_connection_deleted_round_trip(self):
        data = load_fixture("connection_deleted.json")
        instance = ConnectionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.deleted",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_connection_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.deleted",
            "data": {
                "object": "connection",
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "state": "active",
                "name": "Acme SSO",
                "connection_type": "OktaSAML",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_connection_deleted_data_round_trip(self):
        data = load_fixture("connection_deleted_data.json")
        instance = ConnectionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_deleted_data_minimal_payload(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["state"] == data["state"]
        assert serialized["name"] == data["name"]
        assert serialized["connection_type"] == data["connection_type"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_connection_deleted_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "active",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_connection_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "connection",
            "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "state": "unexpected_connection_deleted_data_state",
            "name": "Acme SSO",
            "connection_type": "OktaSAML",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_connection_saml_certificate_renewal_required_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewal_required.json")
        instance = ConnectionSAMLCertificateRenewalRequired.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewalRequired.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewal_required_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.saml_certificate_renewal_required",
            "data": {
                "connection": {
                    "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "certificate": {
                    "certificate_type": "ResponseSigning",
                    "expiry_date": "2026-01-15T12:00:00.000Z",
                    "is_expired": False,
                },
                "days_until_expiry": 30,
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewalRequired.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_connection_saml_certificate_renewal_required_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.saml_certificate_renewal_required",
            "data": {
                "connection": {
                    "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "certificate": {
                    "certificate_type": "ResponseSigning",
                    "expiry_date": "2026-01-15T12:00:00.000Z",
                    "is_expired": False,
                },
                "days_until_expiry": 30,
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewalRequired.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_connection_saml_certificate_renewal_required_data_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewal_required_data.json")
        instance = ConnectionSAMLCertificateRenewalRequiredData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewalRequiredData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewal_required_data_minimal_payload(self):
        data = {
            "connection": {
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "certificate": {
                "certificate_type": "ResponseSigning",
                "expiry_date": "2026-01-15T12:00:00.000Z",
                "is_expired": False,
            },
            "days_until_expiry": 30,
        }
        instance = ConnectionSAMLCertificateRenewalRequiredData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["connection"] == data["connection"]
        assert serialized["certificate"] == data["certificate"]
        assert serialized["days_until_expiry"] == data["days_until_expiry"]

    def test_connection_saml_certificate_renewal_required_data_connection_round_trip(
        self,
    ):
        data = load_fixture(
            "connection_saml_certificate_renewal_required_data_connection.json"
        )
        instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewal_required_data_connection_minimal_payload(
        self,
    ):
        data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]

    def test_connection_saml_certificate_renewal_required_data_connection_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_connection_saml_certificate_renewal_required_data_certificate_round_trip(
        self,
    ):
        data = load_fixture(
            "connection_saml_certificate_renewal_required_data_certificate.json"
        )
        instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewal_required_data_certificate_minimal_payload(
        self,
    ):
        data = {
            "certificate_type": "ResponseSigning",
            "expiry_date": "2026-01-15T12:00:00.000Z",
            "is_expired": False,
        }
        instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["certificate_type"] == data["certificate_type"]
        assert serialized["expiry_date"] == data["expiry_date"]
        assert serialized["is_expired"] == data["is_expired"]

    def test_connection_saml_certificate_renewal_required_data_certificate_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "certificate_type": "unexpected_connection_saml_certificate_renewal_required_data_certificate_certificate_type",
            "expiry_date": "2026-01-15T12:00:00.000Z",
            "is_expired": False,
        }
        instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
            data
        )
        assert instance.to_dict() == data

    def test_connection_saml_certificate_renewed_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewed.json")
        instance = ConnectionSAMLCertificateRenewed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.saml_certificate_renewed",
            "data": {
                "connection": {
                    "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "certificate": {
                    "certificate_type": "ResponseSigning",
                    "expiry_date": "2026-01-15T12:00:00.000Z",
                },
                "renewed_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_connection_saml_certificate_renewed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "connection.saml_certificate_renewed",
            "data": {
                "connection": {
                    "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                },
                "certificate": {
                    "certificate_type": "ResponseSigning",
                    "expiry_date": "2026-01-15T12:00:00.000Z",
                },
                "renewed_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_connection_saml_certificate_renewed_data_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewed_data.json")
        instance = ConnectionSAMLCertificateRenewedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewed_data_minimal_payload(self):
        data = {
            "connection": {
                "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "certificate": {
                "certificate_type": "ResponseSigning",
                "expiry_date": "2026-01-15T12:00:00.000Z",
            },
            "renewed_at": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["connection"] == data["connection"]
        assert serialized["certificate"] == data["certificate"]
        assert serialized["renewed_at"] == data["renewed_at"]

    def test_connection_saml_certificate_renewed_data_connection_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewed_data_connection.json")
        instance = ConnectionSAMLCertificateRenewedDataConnection.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewedDataConnection.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewed_data_connection_minimal_payload(self):
        data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ConnectionSAMLCertificateRenewedDataConnection.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]

    def test_connection_saml_certificate_renewed_data_connection_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"}
        instance = ConnectionSAMLCertificateRenewedDataConnection.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_connection_saml_certificate_renewed_data_certificate_round_trip(self):
        data = load_fixture("connection_saml_certificate_renewed_data_certificate.json")
        instance = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_connection_saml_certificate_renewed_data_certificate_minimal_payload(self):
        data = {
            "certificate_type": "ResponseSigning",
            "expiry_date": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["certificate_type"] == data["certificate_type"]
        assert serialized["expiry_date"] == data["expiry_date"]

    def test_connection_saml_certificate_renewed_data_certificate_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "certificate_type": "unexpected_connection_saml_certificate_renewed_data_certificate_certificate_type",
            "expiry_date": "2026-01-15T12:00:00.000Z",
        }
        instance = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(data)
        assert instance.to_dict() == data

    def test_dsync_activated_round_trip(self):
        data = load_fixture("dsync_activated.json")
        instance = DsyncActivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncActivated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_activated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.activated",
            "data": {
                "object": "directory",
                "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "okta scim v2.0",
                "state": "active",
                "name": "Acme Directory",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncActivated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_activated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.activated",
            "data": {
                "object": "directory",
                "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "okta scim v2.0",
                "state": "active",
                "name": "Acme Directory",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "domain": "acme.com",
                    }
                ],
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncActivated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_activated_data_round_trip(self):
        data = load_fixture("dsync_activated_data.json")
        instance = DsyncActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncActivatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_activated_data_minimal_payload(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "okta scim v2.0",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = DsyncActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["type"] == data["type"]
        assert serialized["state"] == data["state"]
        assert serialized["name"] == data["name"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]
        assert serialized["external_key"] == data["external_key"]
        assert serialized["domains"] == data["domains"]

    def test_dsync_activated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "okta scim v2.0",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = DsyncActivatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_dsync_activated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "unexpected_dsync_activated_data_type",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "domain": "acme.com",
                }
            ],
        }
        instance = DsyncActivatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_dsync_activated_data_domain_round_trip(self):
        data = load_fixture("dsync_activated_data_domain.json")
        instance = DsyncActivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncActivatedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_activated_data_domain_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "domain": "acme.com",
        }
        instance = DsyncActivatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["domain"] == data["domain"]

    def test_dsync_deleted_round_trip(self):
        data = load_fixture("dsync_deleted.json")
        instance = DsyncDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.deleted",
            "data": {
                "object": "directory",
                "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "okta scim v2.0",
                "state": "active",
                "name": "Acme Directory",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.deleted",
            "data": {
                "object": "directory",
                "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "type": "okta scim v2.0",
                "state": "active",
                "name": "Acme Directory",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_deleted_data_round_trip(self):
        data = load_fixture("dsync_deleted_data.json")
        instance = DsyncDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_deleted_data_minimal_payload(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "okta scim v2.0",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["type"] == data["type"]
        assert serialized["state"] == data["state"]
        assert serialized["name"] == data["name"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_dsync_deleted_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "okta scim v2.0",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_dsync_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "directory",
            "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "type": "unexpected_dsync_deleted_data_type",
            "state": "active",
            "name": "Acme Directory",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_dsync_group_created_round_trip(self):
        data = load_fixture("dsync_group_created.json")
        instance = DsyncGroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.created",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_group_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.created",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_deleted_round_trip(self):
        data = load_fixture("dsync_group_deleted.json")
        instance = DsyncGroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.deleted",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_group_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.deleted",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_updated_round_trip(self):
        data = load_fixture("dsync_group_updated.json")
        instance = DsyncGroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.updated",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"key": {}},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_group_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.updated",
            "data": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"key": {}},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_updated_data_round_trip(self):
        data = load_fixture("dsync_group_updated_data.json")
        instance = DsyncGroupUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_updated_data_minimal_payload(self):
        data = {
            "object": "directory_group",
            "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
            "idp_id": "02grqrue4294w24",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "name": "Developers",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["idp_id"] == data["idp_id"]
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["name"] == data["name"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_dsync_group_updated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory_group",
            "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
            "idp_id": "02grqrue4294w24",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "name": "Developers",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "raw_attributes" not in serialized
        assert "previous_attributes" not in serialized

    def test_dsync_token_created_round_trip(self):
        data = load_fixture("dsync_token_created.json")
        instance = DsyncTokenCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncTokenCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_token_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.token.created",
            "data": {
                "object": "directory_token",
                "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "token_suffix": "a1b2",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_token_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.token.created",
            "data": {
                "object": "directory_token",
                "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "token_suffix": "a1b2",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_token_created_data_round_trip(self):
        data = load_fixture("dsync_token_created_data.json")
        instance = DsyncTokenCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncTokenCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_token_created_data_minimal_payload(self):
        data = {
            "object": "directory_token",
            "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "token_suffix": "a1b2",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["token_suffix"] == data["token_suffix"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_token_created_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory_token",
            "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "token_suffix": "a1b2",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_dsync_token_revoked_round_trip(self):
        data = load_fixture("dsync_token_revoked.json")
        instance = DsyncTokenRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncTokenRevoked.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_token_revoked_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.token.revoked",
            "data": {
                "object": "directory_token",
                "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "token_suffix": "a1b2",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_token_revoked_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.token.revoked",
            "data": {
                "object": "directory_token",
                "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "token_suffix": "a1b2",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_token_revoked_data_round_trip(self):
        data = load_fixture("dsync_token_revoked_data.json")
        instance = DsyncTokenRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncTokenRevokedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_token_revoked_data_minimal_payload(self):
        data = {
            "object": "directory_token",
            "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "token_suffix": "a1b2",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["token_suffix"] == data["token_suffix"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_token_revoked_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory_token",
            "id": "directory_token_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "token_suffix": "a1b2",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncTokenRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert "organization_id" not in serialized

    def test_dsync_group_user_added_round_trip(self):
        data = load_fixture("dsync_group_user_added.json")
        instance = DsyncGroupUserAdded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUserAdded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_user_added_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.user_added",
            "data": {
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user": {
                    "object": "directory_user",
                    "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "idp_id": "2836",
                    "email": "marcelina.davis@example.com",
                    "first_name": "Marcelina",
                    "last_name": "Davis",
                    "name": "Marcelina Davis",
                    "emails": [
                        {
                            "primary": True,
                            "type": "work",
                            "value": "marcelina.davis@example.com",
                        }
                    ],
                    "job_title": "Software Engineer",
                    "username": "mdavis",
                    "state": "active",
                    "raw_attributes": {"key": {}},
                    "custom_attributes": {
                        "department": "Engineering",
                        "job_title": "Software Engineer",
                    },
                    "role": {"slug": "admin"},
                    "roles": [{"slug": "admin"}],
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
                "group": {
                    "object": "directory_group",
                    "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                    "idp_id": "02grqrue4294w24",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "name": "Developers",
                    "raw_attributes": {"key": {}},
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUserAdded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_group_user_added_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.user_added",
            "data": {
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user": {
                    "object": "directory_user",
                    "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "idp_id": "2836",
                    "email": "marcelina.davis@example.com",
                    "first_name": "Marcelina",
                    "last_name": "Davis",
                    "name": "Marcelina Davis",
                    "emails": [
                        {
                            "primary": True,
                            "type": "work",
                            "value": "marcelina.davis@example.com",
                        }
                    ],
                    "job_title": "Software Engineer",
                    "username": "mdavis",
                    "state": "active",
                    "raw_attributes": {"key": {}},
                    "custom_attributes": {
                        "department": "Engineering",
                        "job_title": "Software Engineer",
                    },
                    "role": {"slug": "admin"},
                    "roles": [{"slug": "admin"}],
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
                "group": {
                    "object": "directory_group",
                    "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                    "idp_id": "02grqrue4294w24",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "name": "Developers",
                    "raw_attributes": {"key": {}},
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUserAdded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_user_added_data_round_trip(self):
        data = load_fixture("dsync_group_user_added_data.json")
        instance = DsyncGroupUserAddedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUserAddedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_user_added_data_minimal_payload(self):
        data = {
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "group": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
        }
        instance = DsyncGroupUserAddedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["user"] == data["user"]
        assert serialized["group"] == data["group"]

    def test_dsync_user_created_round_trip(self):
        data = load_fixture("dsync_user_created.json")
        instance = DsyncUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncUserCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_user_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.created",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_user_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.created",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_user_deleted_round_trip(self):
        data = load_fixture("dsync_user_deleted.json")
        instance = DsyncUserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncUserDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_user_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.deleted",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_user_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.deleted",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_user_removed_round_trip(self):
        data = load_fixture("dsync_group_user_removed.json")
        instance = DsyncGroupUserRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUserRemoved.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_user_removed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.user_removed",
            "data": {
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user": {
                    "object": "directory_user",
                    "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "idp_id": "2836",
                    "email": "marcelina.davis@example.com",
                    "first_name": "Marcelina",
                    "last_name": "Davis",
                    "name": "Marcelina Davis",
                    "emails": [
                        {
                            "primary": True,
                            "type": "work",
                            "value": "marcelina.davis@example.com",
                        }
                    ],
                    "job_title": "Software Engineer",
                    "username": "mdavis",
                    "state": "active",
                    "raw_attributes": {"key": {}},
                    "custom_attributes": {
                        "department": "Engineering",
                        "job_title": "Software Engineer",
                    },
                    "role": {"slug": "admin"},
                    "roles": [{"slug": "admin"}],
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
                "group": {
                    "object": "directory_group",
                    "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                    "idp_id": "02grqrue4294w24",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "name": "Developers",
                    "raw_attributes": {"key": {}},
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUserRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_group_user_removed_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.group.user_removed",
            "data": {
                "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user": {
                    "object": "directory_user",
                    "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "idp_id": "2836",
                    "email": "marcelina.davis@example.com",
                    "first_name": "Marcelina",
                    "last_name": "Davis",
                    "name": "Marcelina Davis",
                    "emails": [
                        {
                            "primary": True,
                            "type": "work",
                            "value": "marcelina.davis@example.com",
                        }
                    ],
                    "job_title": "Software Engineer",
                    "username": "mdavis",
                    "state": "active",
                    "raw_attributes": {"key": {}},
                    "custom_attributes": {
                        "department": "Engineering",
                        "job_title": "Software Engineer",
                    },
                    "role": {"slug": "admin"},
                    "roles": [{"slug": "admin"}],
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
                "group": {
                    "object": "directory_group",
                    "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                    "idp_id": "02grqrue4294w24",
                    "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                    "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                    "name": "Developers",
                    "raw_attributes": {"key": {}},
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncGroupUserRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_group_user_removed_data_round_trip(self):
        data = load_fixture("dsync_group_user_removed_data.json")
        instance = DsyncGroupUserRemovedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncGroupUserRemovedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_group_user_removed_data_minimal_payload(self):
        data = {
            "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "group": {
                "object": "directory_group",
                "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z",
                "idp_id": "02grqrue4294w24",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "name": "Developers",
                "raw_attributes": {"key": {}},
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
        }
        instance = DsyncGroupUserRemovedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["user"] == data["user"]
        assert serialized["group"] == data["group"]

    def test_dsync_user_updated_round_trip(self):
        data = load_fixture("dsync_user_updated.json")
        instance = DsyncUserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncUserUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_user_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.updated",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"key": {}},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_dsync_user_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "dsync.user.updated",
            "data": {
                "object": "directory_user",
                "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
                "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
                "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
                "idp_id": "2836",
                "email": "marcelina.davis@example.com",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "emails": [
                    {
                        "primary": True,
                        "type": "work",
                        "value": "marcelina.davis@example.com",
                    }
                ],
                "job_title": "Software Engineer",
                "username": "mdavis",
                "state": "active",
                "raw_attributes": {"key": {}},
                "custom_attributes": {
                    "department": "Engineering",
                    "job_title": "Software Engineer",
                },
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
                "previous_attributes": {"key": {}},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_dsync_user_updated_data_round_trip(self):
        data = load_fixture("dsync_user_updated_data.json")
        instance = DsyncUserUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncUserUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_user_updated_data_minimal_payload(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": None,
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["directory_id"] == data["directory_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["idp_id"] == data["idp_id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["raw_attributes"] == data["raw_attributes"]
        assert serialized["custom_attributes"] == data["custom_attributes"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_dsync_user_updated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": "marcelina.davis@example.com",
            "first_name": "Marcelina",
            "last_name": "Davis",
            "name": "Marcelina Davis",
            "job_title": "Software Engineer",
            "username": "mdavis",
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = DsyncUserUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "emails" not in serialized
        assert "role" not in serialized
        assert "roles" not in serialized
        assert "previous_attributes" not in serialized

    def test_dsync_user_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": None,
            "first_name": None,
            "last_name": None,
            "name": None,
            "emails": [
                {
                    "primary": True,
                    "type": "work",
                    "value": "marcelina.davis@example.com",
                }
            ],
            "job_title": None,
            "username": None,
            "state": "active",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "previous_attributes": {"key": {}},
        }
        instance = DsyncUserUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] is None
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None
        assert serialized["name"] is None
        assert serialized["job_title"] is None
        assert serialized["username"] is None

    def test_dsync_user_updated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "directory_user",
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "idp_id": "2836",
            "email": "marcelina.davis@example.com",
            "first_name": "Marcelina",
            "last_name": "Davis",
            "name": "Marcelina Davis",
            "emails": [
                {
                    "primary": True,
                    "type": "work",
                    "value": "marcelina.davis@example.com",
                }
            ],
            "job_title": "Software Engineer",
            "username": "mdavis",
            "state": "unexpected_dsync_user_updated_data_state",
            "raw_attributes": {"key": {}},
            "custom_attributes": {
                "department": "Engineering",
                "job_title": "Software Engineer",
            },
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
            "previous_attributes": {"key": {}},
        }
        instance = DsyncUserUpdatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_dsync_user_updated_data_email_round_trip(self):
        data = load_fixture("dsync_user_updated_data_email.json")
        instance = DsyncUserUpdatedDataEmail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DsyncUserUpdatedDataEmail.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_dsync_user_updated_data_email_minimal_payload(self):
        data = {}
        instance = DsyncUserUpdatedDataEmail.from_dict(data)
        assert instance.to_dict() is not None

    def test_dsync_user_updated_data_email_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {"value": "marcelina.davis@example.com"}
        instance = DsyncUserUpdatedDataEmail.from_dict(data)
        serialized = instance.to_dict()
        assert "primary" not in serialized
        assert "type" not in serialized

    def test_dsync_user_updated_data_email_preserves_nullable_fields(self):
        data = {"primary": True, "type": "work", "value": None}
        instance = DsyncUserUpdatedDataEmail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["value"] is None

    def test_email_verification_created_round_trip(self):
        data = load_fixture("email_verification_created.json")
        instance = EmailVerificationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = EmailVerificationCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_email_verification_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "email_verification.created",
            "data": {
                "object": "email_verification",
                "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = EmailVerificationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_email_verification_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "email_verification.created",
            "data": {
                "object": "email_verification",
                "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = EmailVerificationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_email_verification_created_data_round_trip(self):
        data = load_fixture("email_verification_created_data.json")
        instance = EmailVerificationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = EmailVerificationCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_email_verification_created_data_minimal_payload(self):
        data = {
            "object": "email_verification",
            "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = EmailVerificationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_flag_created_round_trip(self):
        data = load_fixture("flag_created.json")
        instance = FlagCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "flag.created",
            "data": {
                "object": "feature_flag",
                "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
                "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "advanced-analytics",
                "name": "Advanced Analytics",
                "description": "Enable advanced analytics dashboard feature",
                "owner": {
                    "email": "jane@example.com",
                    "first_name": "Jane",
                    "last_name": "Doe",
                },
                "tags": ["reports"],
                "enabled": True,
                "default_value": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "context": {
                "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor": {
                    "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "source": "api",
                    "name": "Jane Doe",
                },
            },
        }
        instance = FlagCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["context"] == data["context"]

    def test_flag_created_data_round_trip(self):
        data = load_fixture("flag_created_data.json")
        instance = FlagCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_created_data_minimal_payload(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["environment_id"] == data["environment_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["owner"] == data["owner"]
        assert serialized["tags"] == data["tags"]
        assert serialized["enabled"] == data["enabled"]
        assert serialized["default_value"] == data["default_value"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_flag_created_data_preserves_nullable_fields(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None
        assert serialized["owner"] is None

    def test_flag_created_data_owner_round_trip(self):
        data = load_fixture("flag_created_data_owner.json")
        instance = FlagCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagCreatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_created_data_owner_minimal_payload(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["first_name"] == data["first_name"]
        assert serialized["last_name"] == data["last_name"]

    def test_flag_created_data_owner_preserves_nullable_fields(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagCreatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None

    def test_flag_created_context_round_trip(self):
        data = load_fixture("flag_created_context.json")
        instance = FlagCreatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagCreatedContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_created_context_minimal_payload(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
        }
        instance = FlagCreatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["client_id"] == data["client_id"]
        assert serialized["actor"] == data["actor"]

    def test_flag_created_context_actor_round_trip(self):
        data = load_fixture("flag_created_context_actor.json")
        instance = FlagCreatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagCreatedContextActor.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_created_context_actor_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagCreatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["source"] == data["source"]
        assert serialized["name"] == data["name"]

    def test_flag_created_context_actor_preserves_nullable_fields(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagCreatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["name"] is None

    def test_flag_created_context_actor_round_trips_unknown_enum_values(self):
        data = {
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "source": "unexpected_flag_created_context_actor_source",
            "name": "Jane Doe",
        }
        instance = FlagCreatedContextActor.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_deleted_round_trip(self):
        data = load_fixture("flag_deleted.json")
        instance = FlagDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "flag.deleted",
            "data": {
                "object": "feature_flag",
                "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
                "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "advanced-analytics",
                "name": "Advanced Analytics",
                "description": "Enable advanced analytics dashboard feature",
                "owner": {
                    "email": "jane@example.com",
                    "first_name": "Jane",
                    "last_name": "Doe",
                },
                "tags": ["reports"],
                "enabled": True,
                "default_value": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "context": {
                "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor": {
                    "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "source": "api",
                    "name": "Jane Doe",
                },
            },
        }
        instance = FlagDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["context"] == data["context"]

    def test_flag_deleted_data_round_trip(self):
        data = load_fixture("flag_deleted_data.json")
        instance = FlagDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_deleted_data_minimal_payload(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["environment_id"] == data["environment_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["owner"] == data["owner"]
        assert serialized["tags"] == data["tags"]
        assert serialized["enabled"] == data["enabled"]
        assert serialized["default_value"] == data["default_value"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_flag_deleted_data_preserves_nullable_fields(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None
        assert serialized["owner"] is None

    def test_flag_deleted_data_owner_round_trip(self):
        data = load_fixture("flag_deleted_data_owner.json")
        instance = FlagDeletedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagDeletedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_deleted_data_owner_minimal_payload(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagDeletedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["first_name"] == data["first_name"]
        assert serialized["last_name"] == data["last_name"]

    def test_flag_deleted_data_owner_preserves_nullable_fields(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagDeletedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None

    def test_flag_deleted_context_round_trip(self):
        data = load_fixture("flag_deleted_context.json")
        instance = FlagDeletedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagDeletedContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_deleted_context_minimal_payload(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
        }
        instance = FlagDeletedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["client_id"] == data["client_id"]
        assert serialized["actor"] == data["actor"]

    def test_flag_deleted_context_actor_round_trip(self):
        data = load_fixture("flag_deleted_context_actor.json")
        instance = FlagDeletedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagDeletedContextActor.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_deleted_context_actor_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagDeletedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["source"] == data["source"]
        assert serialized["name"] == data["name"]

    def test_flag_deleted_context_actor_preserves_nullable_fields(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagDeletedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["name"] is None

    def test_flag_deleted_context_actor_round_trips_unknown_enum_values(self):
        data = {
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "source": "unexpected_flag_deleted_context_actor_source",
            "name": "Jane Doe",
        }
        instance = FlagDeletedContextActor.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_rule_updated_round_trip(self):
        data = load_fixture("flag_rule_updated.json")
        instance = FlagRuleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "flag.rule_updated",
            "data": {
                "object": "feature_flag",
                "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
                "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "advanced-analytics",
                "name": "Advanced Analytics",
                "description": "Enable advanced analytics dashboard feature",
                "owner": {
                    "email": "jane@example.com",
                    "first_name": "Jane",
                    "last_name": "Doe",
                },
                "tags": ["reports"],
                "enabled": True,
                "default_value": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "context": {
                "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor": {
                    "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "source": "api",
                    "name": "Jane Doe",
                },
                "access_type": "none",
                "configured_targets": {
                    "organizations": [
                        {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
                    ],
                    "users": [
                        {
                            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                            "email": "user@example.com",
                        }
                    ],
                },
                "previous_attributes": {
                    "data": {"enabled": True, "default_value": False},
                    "context": {
                        "access_type": "none",
                        "configured_targets": {
                            "organizations": [
                                {
                                    "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                    "name": "Acme Corp",
                                }
                            ],
                            "users": [
                                {
                                    "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                    "email": "user@example.com",
                                }
                            ],
                        },
                    },
                },
            },
        }
        instance = FlagRuleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["context"] == data["context"]

    def test_flag_rule_updated_data_round_trip(self):
        data = load_fixture("flag_rule_updated_data.json")
        instance = FlagRuleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_data_minimal_payload(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagRuleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["environment_id"] == data["environment_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["owner"] == data["owner"]
        assert serialized["tags"] == data["tags"]
        assert serialized["enabled"] == data["enabled"]
        assert serialized["default_value"] == data["default_value"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_flag_rule_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagRuleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None
        assert serialized["owner"] is None

    def test_flag_rule_updated_data_owner_round_trip(self):
        data = load_fixture("flag_rule_updated_data_owner.json")
        instance = FlagRuleUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_data_owner_minimal_payload(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagRuleUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["first_name"] == data["first_name"]
        assert serialized["last_name"] == data["last_name"]

    def test_flag_rule_updated_data_owner_preserves_nullable_fields(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagRuleUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None

    def test_flag_rule_updated_context_round_trip(self):
        data = load_fixture("flag_rule_updated_context.json")
        instance = FlagRuleUpdatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_minimal_payload(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
            "access_type": "none",
            "configured_targets": {
                "organizations": [
                    {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
                ],
                "users": [
                    {
                        "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "email": "user@example.com",
                    }
                ],
            },
            "previous_attributes": {
                "data": {"enabled": True, "default_value": False},
                "context": {
                    "access_type": "none",
                    "configured_targets": {
                        "organizations": [
                            {
                                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                "name": "Acme Corp",
                            }
                        ],
                        "users": [
                            {
                                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                "email": "user@example.com",
                            }
                        ],
                    },
                },
            },
        }
        instance = FlagRuleUpdatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["client_id"] == data["client_id"]
        assert serialized["actor"] == data["actor"]
        assert serialized["access_type"] == data["access_type"]
        assert serialized["configured_targets"] == data["configured_targets"]
        assert serialized["previous_attributes"] == data["previous_attributes"]

    def test_flag_rule_updated_context_round_trips_unknown_enum_values(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
            "access_type": "unexpected_flag_rule_updated_context_access_type",
            "configured_targets": {
                "organizations": [
                    {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
                ],
                "users": [
                    {
                        "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "email": "user@example.com",
                    }
                ],
            },
            "previous_attributes": {
                "data": {"enabled": True, "default_value": False},
                "context": {
                    "access_type": "none",
                    "configured_targets": {
                        "organizations": [
                            {
                                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                "name": "Acme Corp",
                            }
                        ],
                        "users": [
                            {
                                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                                "email": "user@example.com",
                            }
                        ],
                    },
                },
            },
        }
        instance = FlagRuleUpdatedContext.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_rule_updated_context_actor_round_trip(self):
        data = load_fixture("flag_rule_updated_context_actor.json")
        instance = FlagRuleUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextActor.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_actor_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagRuleUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["source"] == data["source"]
        assert serialized["name"] == data["name"]

    def test_flag_rule_updated_context_actor_preserves_nullable_fields(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagRuleUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["name"] is None

    def test_flag_rule_updated_context_actor_round_trips_unknown_enum_values(self):
        data = {
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "source": "unexpected_flag_rule_updated_context_actor_source",
            "name": "Jane Doe",
        }
        instance = FlagRuleUpdatedContextActor.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_rule_updated_context_configured_target_round_trip(self):
        data = load_fixture("flag_rule_updated_context_configured_target.json")
        instance = FlagRuleUpdatedContextConfiguredTarget.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextConfiguredTarget.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_configured_target_minimal_payload(self):
        data = {
            "organizations": [
                {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
            ],
            "users": [
                {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}
            ],
        }
        instance = FlagRuleUpdatedContextConfiguredTarget.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organizations"] == data["organizations"]
        assert serialized["users"] == data["users"]

    def test_flag_rule_updated_context_configured_target_organization_round_trip(self):
        data = load_fixture(
            "flag_rule_updated_context_configured_target_organization.json"
        )
        instance = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_configured_target_organization_minimal_payload(
        self,
    ):
        data = {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
        instance = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["name"] == data["name"]

    def test_flag_rule_updated_context_configured_target_user_round_trip(self):
        data = load_fixture("flag_rule_updated_context_configured_target_user.json")
        instance = FlagRuleUpdatedContextConfiguredTargetUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextConfiguredTargetUser.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_configured_target_user_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}
        instance = FlagRuleUpdatedContextConfiguredTargetUser.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]

    def test_flag_rule_updated_context_previous_attribute_round_trip(self):
        data = load_fixture("flag_rule_updated_context_previous_attribute.json")
        instance = FlagRuleUpdatedContextPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextPreviousAttribute.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_minimal_payload(self):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttribute.from_dict(data)
        assert instance.to_dict() is not None

    def test_flag_rule_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert "data" not in serialized
        assert "context" not in serialized

    def test_flag_rule_updated_context_previous_attribute_data_round_trip(self):
        data = load_fixture("flag_rule_updated_context_previous_attribute_data.json")
        instance = FlagRuleUpdatedContextPreviousAttributeData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextPreviousAttributeData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_data_minimal_payload(self):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttributeData.from_dict(data)
        assert instance.to_dict() is not None

    def test_flag_rule_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttributeData.from_dict(data)
        serialized = instance.to_dict()
        assert "enabled" not in serialized
        assert "default_value" not in serialized

    def test_flag_rule_updated_context_previous_attribute_context_round_trip(self):
        data = load_fixture("flag_rule_updated_context_previous_attribute_context.json")
        instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_context_minimal_payload(self):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data)
        assert instance.to_dict() is not None

    def test_flag_rule_updated_context_previous_attribute_context_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {}
        instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data)
        serialized = instance.to_dict()
        assert "access_type" not in serialized
        assert "configured_targets" not in serialized

    def test_flag_rule_updated_context_previous_attribute_context_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "access_type": "unexpected_flag_rule_updated_context_previous_attribute_context_access_type",
            "configured_targets": {
                "organizations": [
                    {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
                ],
                "users": [
                    {
                        "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                        "email": "user@example.com",
                    }
                ],
            },
        }
        instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip(
        self,
    ):
        data = load_fixture(
            "flag_rule_updated_context_previous_attribute_context_configured_target.json"
        )
        instance = (
            FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(
                data
            )
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = (
            FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(
                serialized
            )
        )
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_minimal_payload(
        self,
    ):
        data = {
            "organizations": [
                {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
            ],
            "users": [
                {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}
            ],
        }
        instance = (
            FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(
                data
            )
        )
        serialized = instance.to_dict()
        assert serialized["organizations"] == data["organizations"]
        assert serialized["users"] == data["users"]

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip(
        self,
    ):
        data = load_fixture(
            "flag_rule_updated_context_previous_attribute_context_configured_target_organization.json"
        )
        instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_minimal_payload(
        self,
    ):
        data = {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
        instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["name"] == data["name"]

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip(
        self,
    ):
        data = load_fixture(
            "flag_rule_updated_context_previous_attribute_context_configured_target_user.json"
        )
        instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_minimal_payload(
        self,
    ):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}
        instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]

    def test_flag_updated_round_trip(self):
        data = load_fixture("flag_updated.json")
        instance = FlagUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "flag.updated",
            "data": {
                "object": "feature_flag",
                "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
                "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "advanced-analytics",
                "name": "Advanced Analytics",
                "description": "Enable advanced analytics dashboard feature",
                "owner": {
                    "email": "jane@example.com",
                    "first_name": "Jane",
                    "last_name": "Doe",
                },
                "tags": ["reports"],
                "enabled": True,
                "default_value": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
            "context": {
                "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor": {
                    "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                    "source": "api",
                    "name": "Jane Doe",
                },
                "previous_attributes": {
                    "data": {
                        "name": "My Feature Flag",
                        "description": "Enables the new feature.",
                        "tags": ["beta", "release"],
                        "enabled": True,
                        "default_value": False,
                    }
                },
            },
        }
        instance = FlagUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["context"] == data["context"]

    def test_flag_updated_data_round_trip(self):
        data = load_fixture("flag_updated_data.json")
        instance = FlagUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_data_minimal_payload(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["environment_id"] == data["environment_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["owner"] == data["owner"]
        assert serialized["tags"] == data["tags"]
        assert serialized["enabled"] == data["enabled"]
        assert serialized["default_value"] == data["default_value"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_flag_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "feature_flag",
            "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT",
            "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "advanced-analytics",
            "name": "Advanced Analytics",
            "description": None,
            "owner": None,
            "tags": ["reports"],
            "enabled": True,
            "default_value": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = FlagUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None
        assert serialized["owner"] is None

    def test_flag_updated_data_owner_round_trip(self):
        data = load_fixture("flag_updated_data_owner.json")
        instance = FlagUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedDataOwner.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_data_owner_minimal_payload(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["first_name"] == data["first_name"]
        assert serialized["last_name"] == data["last_name"]

    def test_flag_updated_data_owner_preserves_nullable_fields(self):
        data = {"email": "jane@example.com", "first_name": None, "last_name": None}
        instance = FlagUpdatedDataOwner.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["first_name"] is None
        assert serialized["last_name"] is None

    def test_flag_updated_context_round_trip(self):
        data = load_fixture("flag_updated_context.json")
        instance = FlagUpdatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedContext.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_context_minimal_payload(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
        }
        instance = FlagUpdatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["client_id"] == data["client_id"]
        assert serialized["actor"] == data["actor"]

    def test_flag_updated_context_omits_absent_optional_non_nullable_fields(self):
        data = {
            "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor": {
                "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "source": "api",
                "name": "Jane Doe",
            },
        }
        instance = FlagUpdatedContext.from_dict(data)
        serialized = instance.to_dict()
        assert "previous_attributes" not in serialized

    def test_flag_updated_context_actor_round_trip(self):
        data = load_fixture("flag_updated_context_actor.json")
        instance = FlagUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedContextActor.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_context_actor_minimal_payload(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["id"] == data["id"]
        assert serialized["source"] == data["source"]
        assert serialized["name"] == data["name"]

    def test_flag_updated_context_actor_preserves_nullable_fields(self):
        data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": None}
        instance = FlagUpdatedContextActor.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["name"] is None

    def test_flag_updated_context_actor_round_trips_unknown_enum_values(self):
        data = {
            "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "source": "unexpected_flag_updated_context_actor_source",
            "name": "Jane Doe",
        }
        instance = FlagUpdatedContextActor.from_dict(data)
        assert instance.to_dict() == data

    def test_flag_updated_context_previous_attribute_round_trip(self):
        data = load_fixture("flag_updated_context_previous_attribute.json")
        instance = FlagUpdatedContextPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedContextPreviousAttribute.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_context_previous_attribute_minimal_payload(self):
        data = {}
        instance = FlagUpdatedContextPreviousAttribute.from_dict(data)
        assert instance.to_dict() is not None

    def test_flag_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {}
        instance = FlagUpdatedContextPreviousAttribute.from_dict(data)
        serialized = instance.to_dict()
        assert "data" not in serialized

    def test_flag_updated_context_previous_attribute_data_round_trip(self):
        data = load_fixture("flag_updated_context_previous_attribute_data.json")
        instance = FlagUpdatedContextPreviousAttributeData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = FlagUpdatedContextPreviousAttributeData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_flag_updated_context_previous_attribute_data_minimal_payload(self):
        data = {}
        instance = FlagUpdatedContextPreviousAttributeData.from_dict(data)
        assert instance.to_dict() is not None

    def test_flag_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {"description": "Enables the new feature."}
        instance = FlagUpdatedContextPreviousAttributeData.from_dict(data)
        serialized = instance.to_dict()
        assert "name" not in serialized
        assert "tags" not in serialized
        assert "enabled" not in serialized
        assert "default_value" not in serialized

    def test_flag_updated_context_previous_attribute_data_preserves_nullable_fields(
        self,
    ):
        data = {
            "name": "My Feature Flag",
            "description": None,
            "tags": ["beta", "release"],
            "enabled": True,
            "default_value": False,
        }
        instance = FlagUpdatedContextPreviousAttributeData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_group_created_round_trip(self):
        data = load_fixture("group_created.json")
        instance = GroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.created",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_group_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.created",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_group_deleted_round_trip(self):
        data = load_fixture("group_deleted.json")
        instance = GroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.deleted",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_group_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.deleted",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_group_member_added_round_trip(self):
        data = load_fixture("group_member_added.json")
        instance = GroupMemberAdded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupMemberAdded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_member_added_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.member_added",
            "data": {
                "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupMemberAdded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_group_member_added_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.member_added",
            "data": {
                "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupMemberAdded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_group_member_added_data_round_trip(self):
        data = load_fixture("group_member_added_data.json")
        instance = GroupMemberAddedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupMemberAddedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_member_added_data_minimal_payload(self):
        data = {
            "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
            "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = GroupMemberAddedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["group_id"] == data["group_id"]
        assert (
            serialized["organization_membership_id"]
            == data["organization_membership_id"]
        )

    def test_group_member_removed_round_trip(self):
        data = load_fixture("group_member_removed.json")
        instance = GroupMemberRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupMemberRemoved.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_member_removed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.member_removed",
            "data": {
                "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupMemberRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_group_member_removed_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.member_removed",
            "data": {
                "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupMemberRemoved.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_group_member_removed_data_round_trip(self):
        data = load_fixture("group_member_removed_data.json")
        instance = GroupMemberRemovedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupMemberRemovedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_member_removed_data_minimal_payload(self):
        data = {
            "group_id": "group_01HXYZ123456789ABCDEFGHIJ",
            "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = GroupMemberRemovedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["group_id"] == data["group_id"]
        assert (
            serialized["organization_membership_id"]
            == data["organization_membership_id"]
        )

    def test_group_updated_round_trip(self):
        data = load_fixture("group_updated.json")
        instance = GroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = GroupUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_group_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.updated",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_group_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "group.updated",
            "data": {
                "object": "group",
                "id": "group_01HXYZ123456789ABCDEFGHIJ",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Engineering",
                "description": "The engineering team",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = GroupUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_invitation_accepted_round_trip(self):
        data = load_fixture("invitation_accepted.json")
        instance = InvitationAccepted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationAccepted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_accepted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.accepted",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationAccepted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_invitation_accepted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.accepted",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationAccepted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_invitation_accepted_data_round_trip(self):
        data = load_fixture("invitation_accepted_data.json")
        instance = InvitationAcceptedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationAcceptedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_accepted_data_minimal_payload(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationAcceptedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["accepted_at"] == data["accepted_at"]
        assert serialized["revoked_at"] == data["revoked_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["inviter_user_id"] == data["inviter_user_id"]
        assert serialized["accepted_user_id"] == data["accepted_user_id"]
        assert serialized["role_slug"] == data["role_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_invitation_accepted_data_preserves_nullable_fields(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationAcceptedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["accepted_at"] is None
        assert serialized["revoked_at"] is None
        assert serialized["organization_id"] is None
        assert serialized["inviter_user_id"] is None
        assert serialized["accepted_user_id"] is None
        assert serialized["role_slug"] is None

    def test_invitation_accepted_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "unexpected_invitation_accepted_data_state",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
            "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
            "accepted_user_id": None,
            "role_slug": "admin",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationAcceptedData.from_dict(data)
        assert instance.to_dict() == data

    def test_invitation_created_round_trip(self):
        data = load_fixture("invitation_created.json")
        instance = InvitationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.created",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_invitation_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.created",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_invitation_created_data_round_trip(self):
        data = load_fixture("invitation_created_data.json")
        instance = InvitationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_created_data_minimal_payload(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["accepted_at"] == data["accepted_at"]
        assert serialized["revoked_at"] == data["revoked_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["inviter_user_id"] == data["inviter_user_id"]
        assert serialized["accepted_user_id"] == data["accepted_user_id"]
        assert serialized["role_slug"] == data["role_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_invitation_created_data_preserves_nullable_fields(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["accepted_at"] is None
        assert serialized["revoked_at"] is None
        assert serialized["organization_id"] is None
        assert serialized["inviter_user_id"] is None
        assert serialized["accepted_user_id"] is None
        assert serialized["role_slug"] is None

    def test_invitation_created_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "unexpected_invitation_created_data_state",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
            "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
            "accepted_user_id": None,
            "role_slug": "admin",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_invitation_resent_round_trip(self):
        data = load_fixture("invitation_resent.json")
        instance = InvitationResent.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationResent.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_resent_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.resent",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationResent.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_invitation_resent_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.resent",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationResent.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_invitation_resent_data_round_trip(self):
        data = load_fixture("invitation_resent_data.json")
        instance = InvitationResentData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationResentData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_resent_data_minimal_payload(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationResentData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["accepted_at"] == data["accepted_at"]
        assert serialized["revoked_at"] == data["revoked_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["inviter_user_id"] == data["inviter_user_id"]
        assert serialized["accepted_user_id"] == data["accepted_user_id"]
        assert serialized["role_slug"] == data["role_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_invitation_resent_data_preserves_nullable_fields(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationResentData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["accepted_at"] is None
        assert serialized["revoked_at"] is None
        assert serialized["organization_id"] is None
        assert serialized["inviter_user_id"] is None
        assert serialized["accepted_user_id"] is None
        assert serialized["role_slug"] is None

    def test_invitation_resent_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "unexpected_invitation_resent_data_state",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
            "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
            "accepted_user_id": None,
            "role_slug": "admin",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationResentData.from_dict(data)
        assert instance.to_dict() == data

    def test_invitation_revoked_round_trip(self):
        data = load_fixture("invitation_revoked.json")
        instance = InvitationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationRevoked.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_revoked_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.revoked",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_invitation_revoked_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "invitation.revoked",
            "data": {
                "object": "invitation",
                "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "accepted_at": None,
                "revoked_at": None,
                "expires_at": "2026-01-15T12:00:00.000Z",
                "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
                "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
                "accepted_user_id": None,
                "role_slug": "admin",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_invitation_revoked_data_round_trip(self):
        data = load_fixture("invitation_revoked_data.json")
        instance = InvitationRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = InvitationRevokedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_invitation_revoked_data_minimal_payload(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["email"] == data["email"]
        assert serialized["state"] == data["state"]
        assert serialized["accepted_at"] == data["accepted_at"]
        assert serialized["revoked_at"] == data["revoked_at"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["inviter_user_id"] == data["inviter_user_id"]
        assert serialized["accepted_user_id"] == data["accepted_user_id"]
        assert serialized["role_slug"] == data["role_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_invitation_revoked_data_preserves_nullable_fields(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "pending",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": None,
            "inviter_user_id": None,
            "accepted_user_id": None,
            "role_slug": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["accepted_at"] is None
        assert serialized["revoked_at"] is None
        assert serialized["organization_id"] is None
        assert serialized["inviter_user_id"] is None
        assert serialized["accepted_user_id"] is None
        assert serialized["role_slug"] is None

    def test_invitation_revoked_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "invitation",
            "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "state": "unexpected_invitation_revoked_data_state",
            "accepted_at": None,
            "revoked_at": None,
            "expires_at": "2026-01-15T12:00:00.000Z",
            "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5",
            "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3",
            "accepted_user_id": None,
            "role_slug": "admin",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = InvitationRevokedData.from_dict(data)
        assert instance.to_dict() == data

    def test_magic_auth_created_round_trip(self):
        data = load_fixture("magic_auth_created.json")
        instance = MagicAuthCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = MagicAuthCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_magic_auth_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "magic_auth.created",
            "data": {
                "object": "magic_auth",
                "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = MagicAuthCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_magic_auth_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "magic_auth.created",
            "data": {
                "object": "magic_auth",
                "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = MagicAuthCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_magic_auth_created_data_round_trip(self):
        data = load_fixture("magic_auth_created_data.json")
        instance = MagicAuthCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = MagicAuthCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_magic_auth_created_data_minimal_payload(self):
        data = {
            "object": "magic_auth",
            "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = MagicAuthCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_created_round_trip(self):
        data = load_fixture("organization_created.json")
        instance = OrganizationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.created",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.created",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_created_data_round_trip(self):
        data = load_fixture("organization_created_data.json")
        instance = OrganizationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_created_data_minimal_payload(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["name"] == data["name"]
        assert serialized["domains"] == data["domains"]
        assert serialized["metadata"] == data["metadata"]
        assert serialized["external_id"] == data["external_id"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_created_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "stripe_customer_id" not in serialized

    def test_organization_created_data_preserves_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["external_id"] is None

    def test_organization_created_data_domain_round_trip(self):
        data = load_fixture("organization_created_data_domain.json")
        instance = OrganizationCreatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationCreatedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_created_data_domain_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_created_data_domain_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_created_data_domain_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_created_data_domain_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationCreatedDataDomain.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_deleted_round_trip(self):
        data = load_fixture("organization_deleted.json")
        instance = OrganizationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.deleted",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.deleted",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_deleted_data_round_trip(self):
        data = load_fixture("organization_deleted_data.json")
        instance = OrganizationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_deleted_data_minimal_payload(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["name"] == data["name"]
        assert serialized["domains"] == data["domains"]
        assert serialized["metadata"] == data["metadata"]
        assert serialized["external_id"] == data["external_id"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_deleted_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "stripe_customer_id" not in serialized

    def test_organization_deleted_data_preserves_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["external_id"] is None

    def test_organization_deleted_data_domain_round_trip(self):
        data = load_fixture("organization_deleted_data_domain.json")
        instance = OrganizationDeletedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDeletedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_deleted_data_domain_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_deleted_data_domain_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_deleted_data_domain_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_deleted_data_domain_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDeletedDataDomain.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_domain_created_round_trip(self):
        data = load_fixture("organization_domain_created.json")
        instance = OrganizationDomainCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.created",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_domain_created_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.created",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_domain_created_data_round_trip(self):
        data = load_fixture("organization_domain_created_data.json")
        instance = OrganizationDomainCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_created_data_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_created_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_created_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_created_data_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_domain_deleted_round_trip(self):
        data = load_fixture("organization_domain_deleted.json")
        instance = OrganizationDomainDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.deleted",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_domain_deleted_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.deleted",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_domain_deleted_data_round_trip(self):
        data = load_fixture("organization_domain_deleted_data.json")
        instance = OrganizationDomainDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_deleted_data_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_deleted_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_deleted_data_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_domain_updated_round_trip(self):
        data = load_fixture("organization_domain_updated.json")
        instance = OrganizationDomainUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.updated",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_domain_updated_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.updated",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_domain_updated_data_round_trip(self):
        data = load_fixture("organization_domain_updated_data.json")
        instance = OrganizationDomainUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_updated_data_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_updated_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_updated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_updated_data_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainUpdatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_domain_verification_failed_round_trip(self):
        data = load_fixture("organization_domain_verification_failed.json")
        instance = OrganizationDomainVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainVerificationFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_verification_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.verification_failed",
            "data": {
                "reason": "domain_verification_period_expired",
                "organization_domain": {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_domain_verification_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.verification_failed",
            "data": {
                "reason": "domain_verification_period_expired",
                "organization_domain": {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                },
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerificationFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_domain_verification_failed_data_round_trip(self):
        data = load_fixture("organization_domain_verification_failed_data.json")
        instance = OrganizationDomainVerificationFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainVerificationFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_verification_failed_data_minimal_payload(self):
        data = {
            "reason": "domain_verification_period_expired",
            "organization_domain": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
        }
        instance = OrganizationDomainVerificationFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["reason"] == data["reason"]
        assert serialized["organization_domain"] == data["organization_domain"]

    def test_organization_domain_verification_failed_data_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "reason": "unexpected_organization_domain_verification_failed_data_reason",
            "organization_domain": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
        }
        instance = OrganizationDomainVerificationFailedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_domain_verification_failed_data_organization_domain_round_trip(
        self,
    ):
        data = load_fixture(
            "organization_domain_verification_failed_data_organization_domain.json"
        )
        instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
            serialized
        )
        assert restored.to_dict() == serialized

    def test_organization_domain_verification_failed_data_organization_domain_minimal_payload(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_verification_failed_data_organization_domain_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
            data
        )
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_verification_failed_data_organization_domain_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_verification_failed_data_organization_domain_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
            data
        )
        assert instance.to_dict() == data

    def test_organization_domain_verified_round_trip(self):
        data = load_fixture("organization_domain_verified.json")
        instance = OrganizationDomainVerified.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainVerified.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_verified_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.verified",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerified.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_domain_verified_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_domain.verified",
            "data": {
                "object": "organization_domain",
                "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                "domain": "foo-corp.com",
                "state": "pending",
                "verification_prefix": "superapp-domain-verification-z3kjny",
                "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                "verification_strategy": "dns",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerified.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_domain_verified_data_round_trip(self):
        data = load_fixture("organization_domain_verified_data.json")
        instance = OrganizationDomainVerifiedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomainVerifiedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_verified_data_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerifiedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_verified_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerifiedData.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_verified_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_verified_data_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomainVerifiedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_membership_created_round_trip(self):
        data = load_fixture("organization_membership_created.json")
        instance = OrganizationMembershipCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.created",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_membership_created_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.created",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_membership_created_data_round_trip(self):
        data = load_fixture("organization_membership_created_data.json")
        instance = OrganizationMembershipCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_created_data_minimal_payload(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["status"] == data["status"]
        assert serialized["role"] == data["role"]
        assert serialized["custom_attributes"] == data["custom_attributes"]
        assert serialized["directory_managed"] == data["directory_managed"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_membership_created_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "roles" not in serialized

    def test_organization_membership_created_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "unexpected_organization_membership_created_data_status",
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_membership_deleted_round_trip(self):
        data = load_fixture("organization_membership_deleted.json")
        instance = OrganizationMembershipDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.deleted",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_membership_deleted_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.deleted",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_membership_deleted_data_round_trip(self):
        data = load_fixture("organization_membership_deleted_data.json")
        instance = OrganizationMembershipDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_deleted_data_minimal_payload(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["status"] == data["status"]
        assert serialized["role"] == data["role"]
        assert serialized["custom_attributes"] == data["custom_attributes"]
        assert serialized["directory_managed"] == data["directory_managed"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_membership_deleted_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "roles" not in serialized

    def test_organization_membership_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "unexpected_organization_membership_deleted_data_status",
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_membership_updated_round_trip(self):
        data = load_fixture("organization_membership_updated.json")
        instance = OrganizationMembershipUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.updated",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_membership_updated_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_membership.updated",
            "data": {
                "object": "organization_membership",
                "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "status": "active",
                "role": {"slug": "admin"},
                "roles": [{"slug": "admin"}],
                "custom_attributes": {"key": {}},
                "directory_managed": False,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_membership_updated_data_round_trip(self):
        data = load_fixture("organization_membership_updated_data.json")
        instance = OrganizationMembershipUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationMembershipUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_membership_updated_data_minimal_payload(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["status"] == data["status"]
        assert serialized["role"] == data["role"]
        assert serialized["custom_attributes"] == data["custom_attributes"]
        assert serialized["directory_managed"] == data["directory_managed"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_membership_updated_data_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "active",
            "role": {"slug": "admin"},
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "roles" not in serialized

    def test_organization_membership_updated_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_membership",
            "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "status": "unexpected_organization_membership_updated_data_status",
            "role": {"slug": "admin"},
            "roles": [{"slug": "admin"}],
            "custom_attributes": {"key": {}},
            "directory_managed": False,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationMembershipUpdatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_organization_role_created_round_trip(self):
        data = load_fixture("organization_role_created.json")
        instance = OrganizationRoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.created",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_role_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.created",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_role_created_data_round_trip(self):
        data = load_fixture("organization_role_created_data.json")
        instance = OrganizationRoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_created_data_minimal_payload(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_role_created_data_preserves_nullable_fields(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_organization_role_deleted_round_trip(self):
        data = load_fixture("organization_role_deleted.json")
        instance = OrganizationRoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.deleted",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_role_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.deleted",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_role_deleted_data_round_trip(self):
        data = load_fixture("organization_role_deleted_data.json")
        instance = OrganizationRoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_deleted_data_minimal_payload(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_role_deleted_data_preserves_nullable_fields(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_organization_role_updated_round_trip(self):
        data = load_fixture("organization_role_updated.json")
        instance = OrganizationRoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.updated",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_role_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization_role.updated",
            "data": {
                "object": "organization_role",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing-admin",
                "name": "Billing Administrator",
                "description": "Can manage billing settings.",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_role_updated_data_round_trip(self):
        data = load_fixture("organization_role_updated_data.json")
        instance = OrganizationRoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationRoleUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_role_updated_data_minimal_payload(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["permissions"] == data["permissions"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_role_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "organization_role",
            "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing-admin",
            "name": "Billing Administrator",
            "description": None,
            "resource_type_slug": "organization",
            "permissions": ["users:read", "users:write"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationRoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_organization_updated_round_trip(self):
        data = load_fixture("organization_updated.json")
        instance = OrganizationUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.updated",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_organization_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "organization.updated",
            "data": {
                "object": "organization",
                "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "name": "Acme Inc.",
                "domains": [
                    {
                        "object": "organization_domain",
                        "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                        "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                        "domain": "foo-corp.com",
                        "state": "pending",
                        "verification_prefix": "superapp-domain-verification-z3kjny",
                        "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                        "verification_strategy": "dns",
                        "created_at": "2026-01-15T12:00:00.000Z",
                        "updated_at": "2026-01-15T12:00:00.000Z",
                    }
                ],
                "metadata": {"tier": "diamond"},
                "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
                "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_organization_updated_data_round_trip(self):
        data = load_fixture("organization_updated_data.json")
        instance = OrganizationUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_updated_data_minimal_payload(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["name"] == data["name"]
        assert serialized["domains"] == data["domains"]
        assert serialized["metadata"] == data["metadata"]
        assert serialized["external_id"] == data["external_id"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_updated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "stripe_customer_id" not in serialized

    def test_organization_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "organization",
            "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "name": "Acme Inc.",
            "domains": [
                {
                    "object": "organization_domain",
                    "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
                    "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
                    "domain": "foo-corp.com",
                    "state": "pending",
                    "verification_prefix": "superapp-domain-verification-z3kjny",
                    "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
                    "verification_strategy": "dns",
                    "created_at": "2026-01-15T12:00:00.000Z",
                    "updated_at": "2026-01-15T12:00:00.000Z",
                }
            ],
            "metadata": {"tier": "diamond"},
            "external_id": None,
            "stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["external_id"] is None

    def test_organization_updated_data_domain_round_trip(self):
        data = load_fixture("organization_updated_data_domain.json")
        instance = OrganizationUpdatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationUpdatedDataDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_updated_data_domain_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_updated_data_domain_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedDataDomain.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_updated_data_domain_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_updated_data_domain_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationUpdatedDataDomain.from_dict(data)
        assert instance.to_dict() == data

    def test_password_reset_created_round_trip(self):
        data = load_fixture("password_reset_created.json")
        instance = PasswordResetCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PasswordResetCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_password_reset_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "password_reset.created",
            "data": {
                "object": "password_reset",
                "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_password_reset_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "password_reset.created",
            "data": {
                "object": "password_reset",
                "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_password_reset_created_data_round_trip(self):
        data = load_fixture("password_reset_created_data.json")
        instance = PasswordResetCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PasswordResetCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_password_reset_created_data_minimal_payload(self):
        data = {
            "object": "password_reset",
            "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["created_at"] == data["created_at"]

    def test_password_reset_succeeded_round_trip(self):
        data = load_fixture("password_reset_succeeded.json")
        instance = PasswordResetSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PasswordResetSucceeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_password_reset_succeeded_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "password_reset.succeeded",
            "data": {
                "object": "password_reset",
                "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_password_reset_succeeded_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "password_reset.succeeded",
            "data": {
                "object": "password_reset",
                "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetSucceeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_password_reset_succeeded_data_round_trip(self):
        data = load_fixture("password_reset_succeeded_data.json")
        instance = PasswordResetSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PasswordResetSucceededData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_password_reset_succeeded_data_minimal_payload(self):
        data = {
            "object": "password_reset",
            "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "marcelina.davis@example.com",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PasswordResetSucceededData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["created_at"] == data["created_at"]

    def test_permission_created_round_trip(self):
        data = load_fixture("permission_created.json")
        instance = PermissionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.created",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_permission_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.created",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_permission_created_data_round_trip(self):
        data = load_fixture("permission_created_data.json")
        instance = PermissionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_created_data_minimal_payload(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["system"] == data["system"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_permission_created_data_preserves_nullable_fields(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_permission_deleted_round_trip(self):
        data = load_fixture("permission_deleted.json")
        instance = PermissionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.deleted",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_permission_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.deleted",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_permission_deleted_data_round_trip(self):
        data = load_fixture("permission_deleted_data.json")
        instance = PermissionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_deleted_data_minimal_payload(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["system"] == data["system"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_permission_deleted_data_preserves_nullable_fields(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_permission_updated_round_trip(self):
        data = load_fixture("permission_updated.json")
        instance = PermissionUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.updated",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_permission_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "permission.updated",
            "data": {
                "object": "permission",
                "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "slug": "billing:manage",
                "name": "Manage Billing",
                "description": "Allows managing billing settings.",
                "system": False,
                "resource_type_slug": "organization",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_permission_updated_data_round_trip(self):
        data = load_fixture("permission_updated_data.json")
        instance = PermissionUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PermissionUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_permission_updated_data_minimal_payload(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["slug"] == data["slug"]
        assert serialized["name"] == data["name"]
        assert serialized["description"] == data["description"]
        assert serialized["system"] == data["system"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_permission_updated_data_preserves_nullable_fields(self):
        data = {
            "object": "permission",
            "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "slug": "billing:manage",
            "name": "Manage Billing",
            "description": None,
            "system": False,
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PermissionUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["description"] is None

    def test_pipes_connected_account_connected_round_trip(self):
        data = load_fixture("pipes_connected_account_connected.json")
        instance = PipesConnectedAccountConnected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipesConnectedAccountConnected.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipes_connected_account_connected_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.connected",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_pipes_connected_account_connected_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.connected",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnected.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_pipes_connected_account_connection_failed_round_trip(self):
        data = load_fixture("pipes_connected_account_connection_failed.json")
        instance = PipesConnectedAccountConnectionFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipesConnectedAccountConnectionFailed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipes_connected_account_connection_failed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.connection_failed",
            "data": {
                "object": "connection_failed",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "error_code": "authorization_code_exchange_error",
                "error_reason": "The authorization code has expired.",
                "provider_error": "access_denied",
                "provider_error_description": "The user denied the authorization request.",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnectionFailed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_pipes_connected_account_connection_failed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.connection_failed",
            "data": {
                "object": "connection_failed",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "error_code": "authorization_code_exchange_error",
                "error_reason": "The authorization code has expired.",
                "provider_error": "access_denied",
                "provider_error_description": "The user denied the authorization request.",
                "created_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnectionFailed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_pipes_connected_account_connection_failed_data_round_trip(self):
        data = load_fixture("pipes_connected_account_connection_failed_data.json")
        instance = PipesConnectedAccountConnectionFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipesConnectedAccountConnectionFailedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipes_connected_account_connection_failed_data_minimal_payload(self):
        data = {
            "object": "connection_failed",
            "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
            "provider_slug": "github",
            "user_id": None,
            "organization_id": None,
            "error_code": "authorization_code_exchange_error",
            "error_reason": None,
            "provider_error": None,
            "provider_error_description": None,
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnectionFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["data_integration_id"] == data["data_integration_id"]
        assert serialized["provider_slug"] == data["provider_slug"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["error_code"] == data["error_code"]
        assert serialized["error_reason"] == data["error_reason"]
        assert serialized["provider_error"] == data["provider_error"]
        assert (
            serialized["provider_error_description"]
            == data["provider_error_description"]
        )
        assert serialized["created_at"] == data["created_at"]

    def test_pipes_connected_account_connection_failed_data_preserves_nullable_fields(
        self,
    ):
        data = {
            "object": "connection_failed",
            "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
            "provider_slug": "github",
            "user_id": None,
            "organization_id": None,
            "error_code": "authorization_code_exchange_error",
            "error_reason": None,
            "provider_error": None,
            "provider_error_description": None,
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountConnectionFailedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["user_id"] is None
        assert serialized["organization_id"] is None
        assert serialized["error_reason"] is None
        assert serialized["provider_error"] is None
        assert serialized["provider_error_description"] is None

    def test_pipes_connected_account_disconnected_round_trip(self):
        data = load_fixture("pipes_connected_account_disconnected.json")
        instance = PipesConnectedAccountDisconnected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipesConnectedAccountDisconnected.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipes_connected_account_disconnected_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.disconnected",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountDisconnected.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_pipes_connected_account_disconnected_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.disconnected",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountDisconnected.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_pipes_connected_account_reauthorization_needed_round_trip(self):
        data = load_fixture("pipes_connected_account_reauthorization_needed.json")
        instance = PipesConnectedAccountReauthorizationNeeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = PipesConnectedAccountReauthorizationNeeded.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_pipes_connected_account_reauthorization_needed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.reauthorization_needed",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountReauthorizationNeeded.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_pipes_connected_account_reauthorization_needed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "pipes.connected_account.reauthorization_needed",
            "data": {
                "object": "connected_account",
                "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
                "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT",
                "provider_slug": "github",
                "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
                "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "scopes": ["repo", "user:email"],
                "state": "connected",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = PipesConnectedAccountReauthorizationNeeded.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_radar_challenge_created_round_trip(self):
        data = load_fixture("radar_challenge_created.json")
        instance = RadarChallengeCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RadarChallengeCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_radar_challenge_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "radar.challenge_created",
            "data": {
                "type": "email",
                "radar_challenge_id": "radar_challenge_01HWZBQZY2M3AMQW166Q22K88F",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RadarChallengeCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_radar_challenge_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "radar.challenge_created",
            "data": {
                "type": "email",
                "radar_challenge_id": "radar_challenge_01HWZBQZY2M3AMQW166Q22K88F",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "user@example.com",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RadarChallengeCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_radar_challenge_created_data_round_trip(self):
        data = load_fixture("radar_challenge_created_data.json")
        instance = RadarChallengeCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RadarChallengeCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_radar_challenge_created_data_minimal_payload(self):
        data = {
            "type": "email",
            "radar_challenge_id": "radar_challenge_01HWZBQZY2M3AMQW166Q22K88F",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "email": "user@example.com",
        }
        instance = RadarChallengeCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["type"] == data["type"]
        assert serialized["radar_challenge_id"] == data["radar_challenge_id"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["email"] == data["email"]

    def test_role_created_round_trip(self):
        data = load_fixture("role_created.json")
        instance = RoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.created",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_role_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.created",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_role_created_data_round_trip(self):
        data = load_fixture("role_created_data.json")
        instance = RoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_created_data_minimal_payload(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["slug"] == data["slug"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_role_created_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "permissions" not in serialized

    def test_role_deleted_round_trip(self):
        data = load_fixture("role_deleted.json")
        instance = RoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.deleted",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_role_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.deleted",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_role_deleted_data_round_trip(self):
        data = load_fixture("role_deleted_data.json")
        instance = RoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_deleted_data_minimal_payload(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["slug"] == data["slug"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_role_deleted_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert "permissions" not in serialized

    def test_role_updated_round_trip(self):
        data = load_fixture("role_updated.json")
        instance = RoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.updated",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_role_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "role.updated",
            "data": {
                "object": "role",
                "slug": "admin",
                "resource_type_slug": "organization",
                "permissions": ["users:read", "users:write"],
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_role_updated_data_round_trip(self):
        data = load_fixture("role_updated_data.json")
        instance = RoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RoleUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_role_updated_data_minimal_payload(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["slug"] == data["slug"]
        assert serialized["resource_type_slug"] == data["resource_type_slug"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_role_updated_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "role",
            "slug": "admin",
            "resource_type_slug": "organization",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = RoleUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "permissions" not in serialized

    def test_session_created_round_trip(self):
        data = load_fixture("session_created.json")
        instance = SessionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "session.created",
            "data": {
                "object": "session",
                "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
                "impersonator": {
                    "email": "admin@foocorp.com",
                    "reason": "Investigating an issue with the customer's account.",
                },
                "ip_address": "198.51.100.42",
                "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "auth_method": "sso",
                "status": "active",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "ended_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_session_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "session.created",
            "data": {
                "object": "session",
                "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
                "impersonator": {
                    "email": "admin@foocorp.com",
                    "reason": "Investigating an issue with the customer's account.",
                },
                "ip_address": "198.51.100.42",
                "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "auth_method": "sso",
                "status": "active",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "ended_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_session_created_data_round_trip(self):
        data = load_fixture("session_created_data.json")
        instance = SessionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_created_data_minimal_payload(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["auth_method"] == data["auth_method"]
        assert serialized["status"] == data["status"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["ended_at"] == data["ended_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_session_created_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "ip_address": "198.51.100.42",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert "impersonator" not in serialized
        assert "organization_id" not in serialized

    def test_session_created_data_preserves_nullable_fields(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "impersonator": {
                "email": "admin@foocorp.com",
                "reason": "Investigating an issue with the customer's account.",
            },
            "ip_address": None,
            "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["ended_at"] is None

    def test_session_created_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "impersonator": {
                "email": "admin@foocorp.com",
                "reason": "Investigating an issue with the customer's account.",
            },
            "ip_address": "198.51.100.42",
            "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "unexpected_session_created_data_auth_method",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_session_created_data_impersonator_round_trip(self):
        data = load_fixture("session_created_data_impersonator.json")
        instance = SessionCreatedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionCreatedDataImpersonator.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_created_data_impersonator_minimal_payload(self):
        data = {"email": "admin@foocorp.com", "reason": None}
        instance = SessionCreatedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["reason"] == data["reason"]

    def test_session_created_data_impersonator_preserves_nullable_fields(self):
        data = {"email": "admin@foocorp.com", "reason": None}
        instance = SessionCreatedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["reason"] is None

    def test_session_revoked_round_trip(self):
        data = load_fixture("session_revoked.json")
        instance = SessionRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionRevoked.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_revoked_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "session.revoked",
            "data": {
                "object": "session",
                "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
                "impersonator": {
                    "email": "admin@foocorp.com",
                    "reason": "Investigating an issue with the customer's account.",
                },
                "ip_address": "198.51.100.42",
                "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "auth_method": "sso",
                "status": "active",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "ended_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_session_revoked_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "session.revoked",
            "data": {
                "object": "session",
                "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
                "impersonator": {
                    "email": "admin@foocorp.com",
                    "reason": "Investigating an issue with the customer's account.",
                },
                "ip_address": "198.51.100.42",
                "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
                "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "auth_method": "sso",
                "status": "active",
                "expires_at": "2026-01-15T12:00:00.000Z",
                "ended_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevoked.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_session_revoked_data_round_trip(self):
        data = load_fixture("session_revoked_data.json")
        instance = SessionRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionRevokedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_revoked_data_minimal_payload(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "ip_address": None,
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["ip_address"] == data["ip_address"]
        assert serialized["user_agent"] == data["user_agent"]
        assert serialized["user_id"] == data["user_id"]
        assert serialized["auth_method"] == data["auth_method"]
        assert serialized["status"] == data["status"]
        assert serialized["expires_at"] == data["expires_at"]
        assert serialized["ended_at"] == data["ended_at"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_session_revoked_data_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "ip_address": "198.51.100.42",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert "impersonator" not in serialized
        assert "organization_id" not in serialized

    def test_session_revoked_data_preserves_nullable_fields(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "impersonator": {
                "email": "admin@foocorp.com",
                "reason": "Investigating an issue with the customer's account.",
            },
            "ip_address": None,
            "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
            "user_agent": None,
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "sso",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevokedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["ip_address"] is None
        assert serialized["user_agent"] is None
        assert serialized["ended_at"] is None

    def test_session_revoked_data_round_trips_unknown_enum_values(self):
        data = {
            "object": "session",
            "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8",
            "impersonator": {
                "email": "admin@foocorp.com",
                "reason": "Investigating an issue with the customer's account.",
            },
            "ip_address": "198.51.100.42",
            "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
            "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5",
            "auth_method": "unexpected_session_revoked_data_auth_method",
            "status": "active",
            "expires_at": "2026-01-15T12:00:00.000Z",
            "ended_at": None,
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = SessionRevokedData.from_dict(data)
        assert instance.to_dict() == data

    def test_session_revoked_data_impersonator_round_trip(self):
        data = load_fixture("session_revoked_data_impersonator.json")
        instance = SessionRevokedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = SessionRevokedDataImpersonator.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_session_revoked_data_impersonator_minimal_payload(self):
        data = {"email": "admin@foocorp.com", "reason": None}
        instance = SessionRevokedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["email"] == data["email"]
        assert serialized["reason"] == data["reason"]

    def test_session_revoked_data_impersonator_preserves_nullable_fields(self):
        data = {"email": "admin@foocorp.com", "reason": None}
        instance = SessionRevokedDataImpersonator.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["reason"] is None

    def test_user_created_round_trip(self):
        data = load_fixture("user_created.json")
        instance = UserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.created",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_user_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.created",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_user_deleted_round_trip(self):
        data = load_fixture("user_deleted.json")
        instance = UserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.deleted",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_user_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.deleted",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_user_updated_round_trip(self):
        data = load_fixture("user_updated.json")
        instance = UserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = UserUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_user_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.updated",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_user_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "user.updated",
            "data": {
                "object": "user",
                "id": "user_01E4ZCR3C56J083X43JQXF3JK5",
                "first_name": "Marcelina",
                "last_name": "Davis",
                "name": "Marcelina Davis",
                "profile_picture_url": "https://workoscdn.com/images/v1/123abc",
                "email": "marcelina.davis@example.com",
                "email_verified": True,
                "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222",
                "metadata": {"timezone": "America/New_York"},
                "last_sign_in_at": "2025-06-25T19:07:33.000Z",
                "locale": "en-US",
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = UserUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_byok_key_deleted_round_trip(self):
        data = load_fixture("vault_byok_key_deleted.json")
        instance = VaultByokKeyDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultByokKeyDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_byok_key_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.byok_key.deleted",
            "data": {
                "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
                "key_provider": "AWS_KMS",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultByokKeyDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_byok_key_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.byok_key.deleted",
            "data": {
                "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
                "key_provider": "AWS_KMS",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultByokKeyDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_byok_key_deleted_data_round_trip(self):
        data = load_fixture("vault_byok_key_deleted_data.json")
        instance = VaultByokKeyDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultByokKeyDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_byok_key_deleted_data_minimal_payload(self):
        data = {
            "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
            "key_provider": "AWS_KMS",
        }
        instance = VaultByokKeyDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["key_provider"] == data["key_provider"]

    def test_vault_byok_key_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
            "key_provider": "unexpected_vault_byok_key_deleted_data_key_provider",
        }
        instance = VaultByokKeyDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_byok_key_verification_completed_round_trip(self):
        data = load_fixture("vault_byok_key_verification_completed.json")
        instance = VaultByokKeyVerificationCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultByokKeyVerificationCompleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_byok_key_verification_completed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.byok_key.verification_completed",
            "data": {
                "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
                "key_provider": "AWS_KMS",
                "verified": True,
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultByokKeyVerificationCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_byok_key_verification_completed_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.byok_key.verification_completed",
            "data": {
                "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
                "key_provider": "AWS_KMS",
                "verified": True,
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultByokKeyVerificationCompleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_byok_key_verification_completed_data_round_trip(self):
        data = load_fixture("vault_byok_key_verification_completed_data.json")
        instance = VaultByokKeyVerificationCompletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultByokKeyVerificationCompletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_byok_key_verification_completed_data_minimal_payload(self):
        data = {
            "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
            "key_provider": "AWS_KMS",
            "verified": True,
        }
        instance = VaultByokKeyVerificationCompletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["key_provider"] == data["key_provider"]
        assert serialized["verified"] == data["verified"]

    def test_vault_byok_key_verification_completed_data_round_trips_unknown_enum_values(
        self,
    ):
        data = {
            "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
            "key_provider": "unexpected_vault_byok_key_verification_completed_data_key_provider",
            "verified": True,
        }
        instance = VaultByokKeyVerificationCompletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_data_created_round_trip(self):
        data = load_fixture("vault_data_created.json")
        instance = VaultDataCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.created",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_data_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.created",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_data_created_data_round_trip(self):
        data = load_fixture("vault_data_created_data.json")
        instance = VaultDataCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_created_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "key_context": {"key": "test_value"},
        }
        instance = VaultDataCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["kv_name"] == data["kv_name"]
        assert serialized["key_id"] == data["key_id"]
        assert serialized["key_context"] == data["key_context"]

    def test_vault_data_created_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_data_created_data_actor_source",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "key_context": {"key": "test_value"},
        }
        instance = VaultDataCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_data_deleted_round_trip(self):
        data = load_fixture("vault_data_deleted.json")
        instance = VaultDataDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.deleted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_data_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.deleted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_data_deleted_data_round_trip(self):
        data = load_fixture("vault_data_deleted_data.json")
        instance = VaultDataDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_deleted_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
        }
        instance = VaultDataDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["kv_name"] == data["kv_name"]

    def test_vault_data_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_data_deleted_data_actor_source",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
        }
        instance = VaultDataDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_data_read_round_trip(self):
        data = load_fixture("vault_data_read.json")
        instance = VaultDataRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataRead.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_read_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_data_read_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataRead.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_data_read_data_round_trip(self):
        data = load_fixture("vault_data_read_data.json")
        instance = VaultDataReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataReadData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_read_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultDataReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["kv_name"] == data["kv_name"]
        assert serialized["key_id"] == data["key_id"]

    def test_vault_data_read_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_data_read_data_actor_source",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultDataReadData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_data_updated_round_trip(self):
        data = load_fixture("vault_data_updated.json")
        instance = VaultDataUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataUpdated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_updated_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.updated",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_data_updated_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.data.updated",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDataUpdated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_data_updated_data_round_trip(self):
        data = load_fixture("vault_data_updated_data.json")
        instance = VaultDataUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDataUpdatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_data_updated_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "key_context": {"key": "test_value"},
        }
        instance = VaultDataUpdatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["kv_name"] == data["kv_name"]
        assert serialized["key_id"] == data["key_id"]
        assert serialized["key_context"] == data["key_context"]

    def test_vault_data_updated_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_data_updated_data_actor_source",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "key_context": {"key": "test_value"},
        }
        instance = VaultDataUpdatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_dek_decrypted_round_trip(self):
        data = load_fixture("vault_dek_decrypted.json")
        instance = VaultDekDecrypted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDekDecrypted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_dek_decrypted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.dek.decrypted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDekDecrypted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_dek_decrypted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.dek.decrypted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDekDecrypted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_dek_decrypted_data_round_trip(self):
        data = load_fixture("vault_dek_decrypted_data.json")
        instance = VaultDekDecryptedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDekDecryptedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_dek_decrypted_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultDekDecryptedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["key_id"] == data["key_id"]

    def test_vault_dek_decrypted_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_dek_decrypted_data_actor_source",
            "actor_name": "Jane Doe",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultDekDecryptedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_dek_read_round_trip(self):
        data = load_fixture("vault_dek_read.json")
        instance = VaultDekRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDekRead.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_dek_read_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.dek.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"],
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDekRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_dek_read_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.dek.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"],
                "key_context": {"key": "test_value"},
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultDekRead.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_dek_read_data_round_trip(self):
        data = load_fixture("vault_dek_read_data.json")
        instance = VaultDekReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultDekReadData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_dek_read_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"],
            "key_context": {"key": "test_value"},
        }
        instance = VaultDekReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["key_ids"] == data["key_ids"]
        assert serialized["key_context"] == data["key_context"]

    def test_vault_dek_read_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_dek_read_data_actor_source",
            "actor_name": "Jane Doe",
            "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"],
            "key_context": {"key": "test_value"},
        }
        instance = VaultDekReadData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_kek_created_round_trip(self):
        data = load_fixture("vault_kek_created.json")
        instance = VaultKekCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultKekCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_kek_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.kek.created",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_name": "production-kek",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultKekCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_kek_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.kek.created",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_name": "production-kek",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultKekCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_kek_created_data_round_trip(self):
        data = load_fixture("vault_kek_created_data.json")
        instance = VaultKekCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultKekCreatedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_kek_created_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "key_name": "production-kek",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultKekCreatedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["key_name"] == data["key_name"]
        assert serialized["key_id"] == data["key_id"]

    def test_vault_kek_created_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_kek_created_data_actor_source",
            "actor_name": "Jane Doe",
            "key_name": "production-kek",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultKekCreatedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_kek_deleted_round_trip(self):
        data = load_fixture("vault_kek_deleted.json")
        instance = VaultKekDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultKekDeleted.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_kek_deleted_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.kek.deleted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_name": "production-kek",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultKekDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_kek_deleted_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.kek.deleted",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "key_name": "production-kek",
                "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultKekDeleted.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_kek_deleted_data_round_trip(self):
        data = load_fixture("vault_kek_deleted_data.json")
        instance = VaultKekDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultKekDeletedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_kek_deleted_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "key_name": "production-kek",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultKekDeletedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["key_name"] == data["key_name"]
        assert serialized["key_id"] == data["key_id"]

    def test_vault_kek_deleted_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_kek_deleted_data_actor_source",
            "actor_name": "Jane Doe",
            "key_name": "production-kek",
            "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY",
        }
        instance = VaultKekDeletedData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_metadata_read_round_trip(self):
        data = load_fixture("vault_metadata_read.json")
        instance = VaultMetadataRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultMetadataRead.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_metadata_read_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.metadata.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultMetadataRead.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_metadata_read_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.metadata.read",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
                "kv_name": "user-secrets",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultMetadataRead.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_metadata_read_data_round_trip(self):
        data = load_fixture("vault_metadata_read_data.json")
        instance = VaultMetadataReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultMetadataReadData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_metadata_read_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
        }
        instance = VaultMetadataReadData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]
        assert serialized["kv_name"] == data["kv_name"]

    def test_vault_metadata_read_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_metadata_read_data_actor_source",
            "actor_name": "Jane Doe",
            "kv_name": "user-secrets",
        }
        instance = VaultMetadataReadData.from_dict(data)
        assert instance.to_dict() == data

    def test_vault_names_listed_round_trip(self):
        data = load_fixture("vault_names_listed.json")
        instance = VaultNamesListed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultNamesListed.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_names_listed_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.names.listed",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultNamesListed.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_vault_names_listed_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "vault.names.listed",
            "data": {
                "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
                "actor_source": "api",
                "actor_name": "Jane Doe",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = VaultNamesListed.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_vault_names_listed_data_round_trip(self):
        data = load_fixture("vault_names_listed_data.json")
        instance = VaultNamesListedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = VaultNamesListedData.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_vault_names_listed_data_minimal_payload(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "api",
            "actor_name": "Jane Doe",
        }
        instance = VaultNamesListedData.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["actor_id"] == data["actor_id"]
        assert serialized["actor_source"] == data["actor_source"]
        assert serialized["actor_name"] == data["actor_name"]

    def test_vault_names_listed_data_round_trips_unknown_enum_values(self):
        data = {
            "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
            "actor_source": "unexpected_vault_names_listed_data_actor_source",
            "actor_name": "Jane Doe",
        }
        instance = VaultNamesListedData.from_dict(data)
        assert instance.to_dict() == data

    def test_waitlist_user_approved_round_trip(self):
        data = load_fixture("waitlist_user_approved.json")
        instance = WaitlistUserApproved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = WaitlistUserApproved.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_waitlist_user_approved_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.approved",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserApproved.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_waitlist_user_approved_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.approved",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserApproved.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_waitlist_user_created_round_trip(self):
        data = load_fixture("waitlist_user_created.json")
        instance = WaitlistUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = WaitlistUserCreated.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_waitlist_user_created_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.created",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_waitlist_user_created_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.created",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserCreated.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_waitlist_user_denied_round_trip(self):
        data = load_fixture("waitlist_user_denied.json")
        instance = WaitlistUserDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = WaitlistUserDenied.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_waitlist_user_denied_minimal_payload(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.denied",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserDenied.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["event"] == data["event"]
        assert serialized["data"] == data["data"]
        assert serialized["created_at"] == data["created_at"]

    def test_waitlist_user_denied_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "event",
            "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
            "event": "waitlist_user.denied",
            "data": {
                "object": "waitlist_user",
                "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
                "email": "marcelina.davis@example.com",
                "state": "pending",
                "approved_at": None,
                "created_at": "2026-01-15T12:00:00.000Z",
                "updated_at": "2026-01-15T12:00:00.000Z",
            },
            "created_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WaitlistUserDenied.from_dict(data)
        serialized = instance.to_dict()
        assert "context" not in serialized

    def test_auth_method_mismatch_error_round_trip(self):
        data = load_fixture("auth_method_mismatch_error.json")
        instance = AuthMethodMismatchError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = AuthMethodMismatchError.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_auth_method_mismatch_error_minimal_payload(self):
        data = {
            "code": "auth_method_mismatch",
            "message": "This installation uses oauth authentication. Use the POST /:slug/token endpoint instead.",
        }
        instance = AuthMethodMismatchError.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["code"] == data["code"]
        assert serialized["message"] == data["message"]

    def test_directory_user_email_round_trip(self):
        data = load_fixture("directory_user_email.json")
        instance = DirectoryUserEmail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = DirectoryUserEmail.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_directory_user_email_minimal_payload(self):
        data = {}
        instance = DirectoryUserEmail.from_dict(data)
        assert instance.to_dict() is not None

    def test_directory_user_email_omits_absent_optional_non_nullable_fields(self):
        data = {"value": "marcelina.davis@example.com"}
        instance = DirectoryUserEmail.from_dict(data)
        serialized = instance.to_dict()
        assert "primary" not in serialized
        assert "type" not in serialized

    def test_directory_user_email_preserves_nullable_fields(self):
        data = {"primary": True, "type": "work", "value": None}
        instance = DirectoryUserEmail.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["value"] is None

    def test_event_context_google_analytics_session_round_trip(self):
        data = load_fixture("event_context_google_analytics_session.json")
        instance = EventContextGoogleAnalyticsSession.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = EventContextGoogleAnalyticsSession.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_event_context_google_analytics_session_minimal_payload(self):
        data = {"containerId": "GTM-ABCDEF"}
        instance = EventContextGoogleAnalyticsSession.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["containerId"] == data["containerId"]

    def test_event_context_google_analytics_session_omits_absent_optional_non_nullable_fields(
        self,
    ):
        data = {"containerId": "GTM-ABCDEF"}
        instance = EventContextGoogleAnalyticsSession.from_dict(data)
        serialized = instance.to_dict()
        assert "sessionId" not in serialized
        assert "sessionNumber" not in serialized
