// File generated from our OpenAPI spec by Stainless.

package com.openai.models.admin.organization.auditlogs

import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.openai.core.JsonValue
import com.openai.core.jsonMapper
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

internal class AuditLogListResponseTest {

    @Test
    fun create() {
        val auditLogListResponse =
            AuditLogListResponse.builder()
                .id("id")
                .effectiveAt(0L)
                .type(AuditLogListResponse.Type.API_KEY_CREATED)
                .actor(
                    AuditLogListResponse.Actor.builder()
                        .apiKey(
                            AuditLogListResponse.Actor.ApiKey.builder()
                                .id("id")
                                .serviceAccount(
                                    AuditLogListResponse.Actor.ApiKey.ServiceAccount.builder()
                                        .id("id")
                                        .build()
                                )
                                .type(AuditLogListResponse.Actor.ApiKey.Type.USER)
                                .user(
                                    AuditLogListResponse.Actor.ApiKey.User.builder()
                                        .id("id")
                                        .email("email")
                                        .build()
                                )
                                .build()
                        )
                        .session(
                            AuditLogListResponse.Actor.Session.builder()
                                .ipAddress("ip_address")
                                .user(
                                    AuditLogListResponse.Actor.Session.User.builder()
                                        .id("id")
                                        .email("email")
                                        .build()
                                )
                                .build()
                        )
                        .type(AuditLogListResponse.Actor.Type.SESSION)
                        .build()
                )
                .apiKeyCreated(
                    AuditLogListResponse.ApiKeyCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ApiKeyCreated.Data.builder()
                                .addScope("string")
                                .build()
                        )
                        .build()
                )
                .apiKeyDeleted(AuditLogListResponse.ApiKeyDeleted.builder().id("id").build())
                .apiKeyUpdated(
                    AuditLogListResponse.ApiKeyUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ApiKeyUpdated.ChangesRequested.builder()
                                .addScope("string")
                                .build()
                        )
                        .build()
                )
                .certificateCreated(
                    AuditLogListResponse.CertificateCreated.builder().id("id").name("name").build()
                )
                .certificateDeleted(
                    AuditLogListResponse.CertificateDeleted.builder()
                        .id("id")
                        .certificate("certificate")
                        .name("name")
                        .build()
                )
                .certificateUpdated(
                    AuditLogListResponse.CertificateUpdated.builder().id("id").name("name").build()
                )
                .certificatesActivated(
                    AuditLogListResponse.CertificatesActivated.builder()
                        .addCertificate(
                            AuditLogListResponse.CertificatesActivated.Certificate.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .certificatesDeactivated(
                    AuditLogListResponse.CertificatesDeactivated.builder()
                        .addCertificate(
                            AuditLogListResponse.CertificatesDeactivated.Certificate.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .checkpointPermissionCreated(
                    AuditLogListResponse.CheckpointPermissionCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.CheckpointPermissionCreated.Data.builder()
                                .fineTunedModelCheckpoint("fine_tuned_model_checkpoint")
                                .projectId("project_id")
                                .build()
                        )
                        .build()
                )
                .checkpointPermissionDeleted(
                    AuditLogListResponse.CheckpointPermissionDeleted.builder().id("id").build()
                )
                .externalKeyRegistered(
                    AuditLogListResponse.ExternalKeyRegistered.builder()
                        .id("id")
                        .data(JsonValue.from(mapOf<String, Any>()))
                        .build()
                )
                .externalKeyRemoved(
                    AuditLogListResponse.ExternalKeyRemoved.builder().id("id").build()
                )
                .groupCreated(
                    AuditLogListResponse.GroupCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.GroupCreated.Data.builder()
                                .groupName("group_name")
                                .build()
                        )
                        .build()
                )
                .groupDeleted(AuditLogListResponse.GroupDeleted.builder().id("id").build())
                .groupUpdated(
                    AuditLogListResponse.GroupUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.GroupUpdated.ChangesRequested.builder()
                                .groupName("group_name")
                                .build()
                        )
                        .build()
                )
                .inviteAccepted(AuditLogListResponse.InviteAccepted.builder().id("id").build())
                .inviteDeleted(AuditLogListResponse.InviteDeleted.builder().id("id").build())
                .inviteSent(
                    AuditLogListResponse.InviteSent.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.InviteSent.Data.builder()
                                .email("email")
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistConfigActivated(
                    AuditLogListResponse.IpAllowlistConfigActivated.builder()
                        .addConfig(
                            AuditLogListResponse.IpAllowlistConfigActivated.Config.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistConfigDeactivated(
                    AuditLogListResponse.IpAllowlistConfigDeactivated.builder()
                        .addConfig(
                            AuditLogListResponse.IpAllowlistConfigDeactivated.Config.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistCreated(
                    AuditLogListResponse.IpAllowlistCreated.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .name("name")
                        .build()
                )
                .ipAllowlistDeleted(
                    AuditLogListResponse.IpAllowlistDeleted.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .name("name")
                        .build()
                )
                .ipAllowlistUpdated(
                    AuditLogListResponse.IpAllowlistUpdated.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .build()
                )
                .loginFailed(
                    AuditLogListResponse.LoginFailed.builder()
                        .errorCode("error_code")
                        .errorMessage("error_message")
                        .build()
                )
                .loginSucceeded(JsonValue.from(mapOf<String, Any>()))
                .logoutFailed(
                    AuditLogListResponse.LogoutFailed.builder()
                        .errorCode("error_code")
                        .errorMessage("error_message")
                        .build()
                )
                .logoutSucceeded(JsonValue.from(mapOf<String, Any>()))
                .organizationUpdated(
                    AuditLogListResponse.OrganizationUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.OrganizationUpdated.ChangesRequested.builder()
                                .apiCallLogging("api_call_logging")
                                .apiCallLoggingProjectIds("api_call_logging_project_ids")
                                .description("description")
                                .name("name")
                                .threadsUiVisibility("threads_ui_visibility")
                                .title("title")
                                .usageDashboardVisibility("usage_dashboard_visibility")
                                .build()
                        )
                        .build()
                )
                .project(AuditLogListResponse.Project.builder().id("id").name("name").build())
                .projectArchived(AuditLogListResponse.ProjectArchived.builder().id("id").build())
                .projectCreated(
                    AuditLogListResponse.ProjectCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ProjectCreated.Data.builder()
                                .name("name")
                                .title("title")
                                .build()
                        )
                        .build()
                )
                .projectDeleted(AuditLogListResponse.ProjectDeleted.builder().id("id").build())
                .projectUpdated(
                    AuditLogListResponse.ProjectUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ProjectUpdated.ChangesRequested.builder()
                                .title("title")
                                .build()
                        )
                        .build()
                )
                .rateLimitDeleted(AuditLogListResponse.RateLimitDeleted.builder().id("id").build())
                .rateLimitUpdated(
                    AuditLogListResponse.RateLimitUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.RateLimitUpdated.ChangesRequested.builder()
                                .batch1DayMaxInputTokens(0L)
                                .maxAudioMegabytesPer1Minute(0L)
                                .maxImagesPer1Minute(0L)
                                .maxRequestsPer1Day(0L)
                                .maxRequestsPer1Minute(0L)
                                .maxTokensPer1Minute(0L)
                                .build()
                        )
                        .build()
                )
                .roleAssignmentCreated(
                    AuditLogListResponse.RoleAssignmentCreated.builder()
                        .id("id")
                        .principalId("principal_id")
                        .principalType("principal_type")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .build()
                )
                .roleAssignmentDeleted(
                    AuditLogListResponse.RoleAssignmentDeleted.builder()
                        .id("id")
                        .principalId("principal_id")
                        .principalType("principal_type")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .build()
                )
                .roleCreated(
                    AuditLogListResponse.RoleCreated.builder()
                        .id("id")
                        .addPermission("string")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .roleName("role_name")
                        .build()
                )
                .roleDeleted(AuditLogListResponse.RoleDeleted.builder().id("id").build())
                .roleUpdated(
                    AuditLogListResponse.RoleUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.RoleUpdated.ChangesRequested.builder()
                                .description("description")
                                .metadata(JsonValue.from(mapOf<String, Any>()))
                                .addPermissionsAdded("string")
                                .addPermissionsRemoved("string")
                                .resourceId("resource_id")
                                .resourceType("resource_type")
                                .roleName("role_name")
                                .build()
                        )
                        .build()
                )
                .scimDisabled(AuditLogListResponse.ScimDisabled.builder().id("id").build())
                .scimEnabled(AuditLogListResponse.ScimEnabled.builder().id("id").build())
                .serviceAccountCreated(
                    AuditLogListResponse.ServiceAccountCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ServiceAccountCreated.Data.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .serviceAccountDeleted(
                    AuditLogListResponse.ServiceAccountDeleted.builder().id("id").build()
                )
                .serviceAccountUpdated(
                    AuditLogListResponse.ServiceAccountUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ServiceAccountUpdated.ChangesRequested.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .userAdded(
                    AuditLogListResponse.UserAdded.builder()
                        .id("id")
                        .data(AuditLogListResponse.UserAdded.Data.builder().role("role").build())
                        .build()
                )
                .userDeleted(AuditLogListResponse.UserDeleted.builder().id("id").build())
                .userUpdated(
                    AuditLogListResponse.UserUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.UserUpdated.ChangesRequested.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .build()

        assertThat(auditLogListResponse.id()).isEqualTo("id")
        assertThat(auditLogListResponse.effectiveAt()).isEqualTo(0L)
        assertThat(auditLogListResponse.type()).isEqualTo(AuditLogListResponse.Type.API_KEY_CREATED)
        assertThat(auditLogListResponse.actor())
            .contains(
                AuditLogListResponse.Actor.builder()
                    .apiKey(
                        AuditLogListResponse.Actor.ApiKey.builder()
                            .id("id")
                            .serviceAccount(
                                AuditLogListResponse.Actor.ApiKey.ServiceAccount.builder()
                                    .id("id")
                                    .build()
                            )
                            .type(AuditLogListResponse.Actor.ApiKey.Type.USER)
                            .user(
                                AuditLogListResponse.Actor.ApiKey.User.builder()
                                    .id("id")
                                    .email("email")
                                    .build()
                            )
                            .build()
                    )
                    .session(
                        AuditLogListResponse.Actor.Session.builder()
                            .ipAddress("ip_address")
                            .user(
                                AuditLogListResponse.Actor.Session.User.builder()
                                    .id("id")
                                    .email("email")
                                    .build()
                            )
                            .build()
                    )
                    .type(AuditLogListResponse.Actor.Type.SESSION)
                    .build()
            )
        assertThat(auditLogListResponse.apiKeyCreated())
            .contains(
                AuditLogListResponse.ApiKeyCreated.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.ApiKeyCreated.Data.builder().addScope("string").build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.apiKeyDeleted())
            .contains(AuditLogListResponse.ApiKeyDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.apiKeyUpdated())
            .contains(
                AuditLogListResponse.ApiKeyUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.ApiKeyUpdated.ChangesRequested.builder()
                            .addScope("string")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.certificateCreated())
            .contains(
                AuditLogListResponse.CertificateCreated.builder().id("id").name("name").build()
            )
        assertThat(auditLogListResponse.certificateDeleted())
            .contains(
                AuditLogListResponse.CertificateDeleted.builder()
                    .id("id")
                    .certificate("certificate")
                    .name("name")
                    .build()
            )
        assertThat(auditLogListResponse.certificateUpdated())
            .contains(
                AuditLogListResponse.CertificateUpdated.builder().id("id").name("name").build()
            )
        assertThat(auditLogListResponse.certificatesActivated())
            .contains(
                AuditLogListResponse.CertificatesActivated.builder()
                    .addCertificate(
                        AuditLogListResponse.CertificatesActivated.Certificate.builder()
                            .id("id")
                            .name("name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.certificatesDeactivated())
            .contains(
                AuditLogListResponse.CertificatesDeactivated.builder()
                    .addCertificate(
                        AuditLogListResponse.CertificatesDeactivated.Certificate.builder()
                            .id("id")
                            .name("name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.checkpointPermissionCreated())
            .contains(
                AuditLogListResponse.CheckpointPermissionCreated.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.CheckpointPermissionCreated.Data.builder()
                            .fineTunedModelCheckpoint("fine_tuned_model_checkpoint")
                            .projectId("project_id")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.checkpointPermissionDeleted())
            .contains(AuditLogListResponse.CheckpointPermissionDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.externalKeyRegistered())
            .contains(
                AuditLogListResponse.ExternalKeyRegistered.builder()
                    .id("id")
                    .data(JsonValue.from(mapOf<String, Any>()))
                    .build()
            )
        assertThat(auditLogListResponse.externalKeyRemoved())
            .contains(AuditLogListResponse.ExternalKeyRemoved.builder().id("id").build())
        assertThat(auditLogListResponse.groupCreated())
            .contains(
                AuditLogListResponse.GroupCreated.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.GroupCreated.Data.builder()
                            .groupName("group_name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.groupDeleted())
            .contains(AuditLogListResponse.GroupDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.groupUpdated())
            .contains(
                AuditLogListResponse.GroupUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.GroupUpdated.ChangesRequested.builder()
                            .groupName("group_name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.inviteAccepted())
            .contains(AuditLogListResponse.InviteAccepted.builder().id("id").build())
        assertThat(auditLogListResponse.inviteDeleted())
            .contains(AuditLogListResponse.InviteDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.inviteSent())
            .contains(
                AuditLogListResponse.InviteSent.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.InviteSent.Data.builder()
                            .email("email")
                            .role("role")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.ipAllowlistConfigActivated())
            .contains(
                AuditLogListResponse.IpAllowlistConfigActivated.builder()
                    .addConfig(
                        AuditLogListResponse.IpAllowlistConfigActivated.Config.builder()
                            .id("id")
                            .name("name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.ipAllowlistConfigDeactivated())
            .contains(
                AuditLogListResponse.IpAllowlistConfigDeactivated.builder()
                    .addConfig(
                        AuditLogListResponse.IpAllowlistConfigDeactivated.Config.builder()
                            .id("id")
                            .name("name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.ipAllowlistCreated())
            .contains(
                AuditLogListResponse.IpAllowlistCreated.builder()
                    .id("id")
                    .addAllowedIp("string")
                    .name("name")
                    .build()
            )
        assertThat(auditLogListResponse.ipAllowlistDeleted())
            .contains(
                AuditLogListResponse.IpAllowlistDeleted.builder()
                    .id("id")
                    .addAllowedIp("string")
                    .name("name")
                    .build()
            )
        assertThat(auditLogListResponse.ipAllowlistUpdated())
            .contains(
                AuditLogListResponse.IpAllowlistUpdated.builder()
                    .id("id")
                    .addAllowedIp("string")
                    .build()
            )
        assertThat(auditLogListResponse.loginFailed())
            .contains(
                AuditLogListResponse.LoginFailed.builder()
                    .errorCode("error_code")
                    .errorMessage("error_message")
                    .build()
            )
        assertThat(auditLogListResponse._loginSucceeded())
            .isEqualTo(JsonValue.from(mapOf<String, Any>()))
        assertThat(auditLogListResponse.logoutFailed())
            .contains(
                AuditLogListResponse.LogoutFailed.builder()
                    .errorCode("error_code")
                    .errorMessage("error_message")
                    .build()
            )
        assertThat(auditLogListResponse._logoutSucceeded())
            .isEqualTo(JsonValue.from(mapOf<String, Any>()))
        assertThat(auditLogListResponse.organizationUpdated())
            .contains(
                AuditLogListResponse.OrganizationUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.OrganizationUpdated.ChangesRequested.builder()
                            .apiCallLogging("api_call_logging")
                            .apiCallLoggingProjectIds("api_call_logging_project_ids")
                            .description("description")
                            .name("name")
                            .threadsUiVisibility("threads_ui_visibility")
                            .title("title")
                            .usageDashboardVisibility("usage_dashboard_visibility")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.project())
            .contains(AuditLogListResponse.Project.builder().id("id").name("name").build())
        assertThat(auditLogListResponse.projectArchived())
            .contains(AuditLogListResponse.ProjectArchived.builder().id("id").build())
        assertThat(auditLogListResponse.projectCreated())
            .contains(
                AuditLogListResponse.ProjectCreated.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.ProjectCreated.Data.builder()
                            .name("name")
                            .title("title")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.projectDeleted())
            .contains(AuditLogListResponse.ProjectDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.projectUpdated())
            .contains(
                AuditLogListResponse.ProjectUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.ProjectUpdated.ChangesRequested.builder()
                            .title("title")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.rateLimitDeleted())
            .contains(AuditLogListResponse.RateLimitDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.rateLimitUpdated())
            .contains(
                AuditLogListResponse.RateLimitUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.RateLimitUpdated.ChangesRequested.builder()
                            .batch1DayMaxInputTokens(0L)
                            .maxAudioMegabytesPer1Minute(0L)
                            .maxImagesPer1Minute(0L)
                            .maxRequestsPer1Day(0L)
                            .maxRequestsPer1Minute(0L)
                            .maxTokensPer1Minute(0L)
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.roleAssignmentCreated())
            .contains(
                AuditLogListResponse.RoleAssignmentCreated.builder()
                    .id("id")
                    .principalId("principal_id")
                    .principalType("principal_type")
                    .resourceId("resource_id")
                    .resourceType("resource_type")
                    .build()
            )
        assertThat(auditLogListResponse.roleAssignmentDeleted())
            .contains(
                AuditLogListResponse.RoleAssignmentDeleted.builder()
                    .id("id")
                    .principalId("principal_id")
                    .principalType("principal_type")
                    .resourceId("resource_id")
                    .resourceType("resource_type")
                    .build()
            )
        assertThat(auditLogListResponse.roleCreated())
            .contains(
                AuditLogListResponse.RoleCreated.builder()
                    .id("id")
                    .addPermission("string")
                    .resourceId("resource_id")
                    .resourceType("resource_type")
                    .roleName("role_name")
                    .build()
            )
        assertThat(auditLogListResponse.roleDeleted())
            .contains(AuditLogListResponse.RoleDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.roleUpdated())
            .contains(
                AuditLogListResponse.RoleUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.RoleUpdated.ChangesRequested.builder()
                            .description("description")
                            .metadata(JsonValue.from(mapOf<String, Any>()))
                            .addPermissionsAdded("string")
                            .addPermissionsRemoved("string")
                            .resourceId("resource_id")
                            .resourceType("resource_type")
                            .roleName("role_name")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.scimDisabled())
            .contains(AuditLogListResponse.ScimDisabled.builder().id("id").build())
        assertThat(auditLogListResponse.scimEnabled())
            .contains(AuditLogListResponse.ScimEnabled.builder().id("id").build())
        assertThat(auditLogListResponse.serviceAccountCreated())
            .contains(
                AuditLogListResponse.ServiceAccountCreated.builder()
                    .id("id")
                    .data(
                        AuditLogListResponse.ServiceAccountCreated.Data.builder()
                            .role("role")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.serviceAccountDeleted())
            .contains(AuditLogListResponse.ServiceAccountDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.serviceAccountUpdated())
            .contains(
                AuditLogListResponse.ServiceAccountUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.ServiceAccountUpdated.ChangesRequested.builder()
                            .role("role")
                            .build()
                    )
                    .build()
            )
        assertThat(auditLogListResponse.userAdded())
            .contains(
                AuditLogListResponse.UserAdded.builder()
                    .id("id")
                    .data(AuditLogListResponse.UserAdded.Data.builder().role("role").build())
                    .build()
            )
        assertThat(auditLogListResponse.userDeleted())
            .contains(AuditLogListResponse.UserDeleted.builder().id("id").build())
        assertThat(auditLogListResponse.userUpdated())
            .contains(
                AuditLogListResponse.UserUpdated.builder()
                    .id("id")
                    .changesRequested(
                        AuditLogListResponse.UserUpdated.ChangesRequested.builder()
                            .role("role")
                            .build()
                    )
                    .build()
            )
    }

    @Test
    fun roundtrip() {
        val jsonMapper = jsonMapper()
        val auditLogListResponse =
            AuditLogListResponse.builder()
                .id("id")
                .effectiveAt(0L)
                .type(AuditLogListResponse.Type.API_KEY_CREATED)
                .actor(
                    AuditLogListResponse.Actor.builder()
                        .apiKey(
                            AuditLogListResponse.Actor.ApiKey.builder()
                                .id("id")
                                .serviceAccount(
                                    AuditLogListResponse.Actor.ApiKey.ServiceAccount.builder()
                                        .id("id")
                                        .build()
                                )
                                .type(AuditLogListResponse.Actor.ApiKey.Type.USER)
                                .user(
                                    AuditLogListResponse.Actor.ApiKey.User.builder()
                                        .id("id")
                                        .email("email")
                                        .build()
                                )
                                .build()
                        )
                        .session(
                            AuditLogListResponse.Actor.Session.builder()
                                .ipAddress("ip_address")
                                .user(
                                    AuditLogListResponse.Actor.Session.User.builder()
                                        .id("id")
                                        .email("email")
                                        .build()
                                )
                                .build()
                        )
                        .type(AuditLogListResponse.Actor.Type.SESSION)
                        .build()
                )
                .apiKeyCreated(
                    AuditLogListResponse.ApiKeyCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ApiKeyCreated.Data.builder()
                                .addScope("string")
                                .build()
                        )
                        .build()
                )
                .apiKeyDeleted(AuditLogListResponse.ApiKeyDeleted.builder().id("id").build())
                .apiKeyUpdated(
                    AuditLogListResponse.ApiKeyUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ApiKeyUpdated.ChangesRequested.builder()
                                .addScope("string")
                                .build()
                        )
                        .build()
                )
                .certificateCreated(
                    AuditLogListResponse.CertificateCreated.builder().id("id").name("name").build()
                )
                .certificateDeleted(
                    AuditLogListResponse.CertificateDeleted.builder()
                        .id("id")
                        .certificate("certificate")
                        .name("name")
                        .build()
                )
                .certificateUpdated(
                    AuditLogListResponse.CertificateUpdated.builder().id("id").name("name").build()
                )
                .certificatesActivated(
                    AuditLogListResponse.CertificatesActivated.builder()
                        .addCertificate(
                            AuditLogListResponse.CertificatesActivated.Certificate.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .certificatesDeactivated(
                    AuditLogListResponse.CertificatesDeactivated.builder()
                        .addCertificate(
                            AuditLogListResponse.CertificatesDeactivated.Certificate.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .checkpointPermissionCreated(
                    AuditLogListResponse.CheckpointPermissionCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.CheckpointPermissionCreated.Data.builder()
                                .fineTunedModelCheckpoint("fine_tuned_model_checkpoint")
                                .projectId("project_id")
                                .build()
                        )
                        .build()
                )
                .checkpointPermissionDeleted(
                    AuditLogListResponse.CheckpointPermissionDeleted.builder().id("id").build()
                )
                .externalKeyRegistered(
                    AuditLogListResponse.ExternalKeyRegistered.builder()
                        .id("id")
                        .data(JsonValue.from(mapOf<String, Any>()))
                        .build()
                )
                .externalKeyRemoved(
                    AuditLogListResponse.ExternalKeyRemoved.builder().id("id").build()
                )
                .groupCreated(
                    AuditLogListResponse.GroupCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.GroupCreated.Data.builder()
                                .groupName("group_name")
                                .build()
                        )
                        .build()
                )
                .groupDeleted(AuditLogListResponse.GroupDeleted.builder().id("id").build())
                .groupUpdated(
                    AuditLogListResponse.GroupUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.GroupUpdated.ChangesRequested.builder()
                                .groupName("group_name")
                                .build()
                        )
                        .build()
                )
                .inviteAccepted(AuditLogListResponse.InviteAccepted.builder().id("id").build())
                .inviteDeleted(AuditLogListResponse.InviteDeleted.builder().id("id").build())
                .inviteSent(
                    AuditLogListResponse.InviteSent.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.InviteSent.Data.builder()
                                .email("email")
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistConfigActivated(
                    AuditLogListResponse.IpAllowlistConfigActivated.builder()
                        .addConfig(
                            AuditLogListResponse.IpAllowlistConfigActivated.Config.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistConfigDeactivated(
                    AuditLogListResponse.IpAllowlistConfigDeactivated.builder()
                        .addConfig(
                            AuditLogListResponse.IpAllowlistConfigDeactivated.Config.builder()
                                .id("id")
                                .name("name")
                                .build()
                        )
                        .build()
                )
                .ipAllowlistCreated(
                    AuditLogListResponse.IpAllowlistCreated.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .name("name")
                        .build()
                )
                .ipAllowlistDeleted(
                    AuditLogListResponse.IpAllowlistDeleted.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .name("name")
                        .build()
                )
                .ipAllowlistUpdated(
                    AuditLogListResponse.IpAllowlistUpdated.builder()
                        .id("id")
                        .addAllowedIp("string")
                        .build()
                )
                .loginFailed(
                    AuditLogListResponse.LoginFailed.builder()
                        .errorCode("error_code")
                        .errorMessage("error_message")
                        .build()
                )
                .loginSucceeded(JsonValue.from(mapOf<String, Any>()))
                .logoutFailed(
                    AuditLogListResponse.LogoutFailed.builder()
                        .errorCode("error_code")
                        .errorMessage("error_message")
                        .build()
                )
                .logoutSucceeded(JsonValue.from(mapOf<String, Any>()))
                .organizationUpdated(
                    AuditLogListResponse.OrganizationUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.OrganizationUpdated.ChangesRequested.builder()
                                .apiCallLogging("api_call_logging")
                                .apiCallLoggingProjectIds("api_call_logging_project_ids")
                                .description("description")
                                .name("name")
                                .threadsUiVisibility("threads_ui_visibility")
                                .title("title")
                                .usageDashboardVisibility("usage_dashboard_visibility")
                                .build()
                        )
                        .build()
                )
                .project(AuditLogListResponse.Project.builder().id("id").name("name").build())
                .projectArchived(AuditLogListResponse.ProjectArchived.builder().id("id").build())
                .projectCreated(
                    AuditLogListResponse.ProjectCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ProjectCreated.Data.builder()
                                .name("name")
                                .title("title")
                                .build()
                        )
                        .build()
                )
                .projectDeleted(AuditLogListResponse.ProjectDeleted.builder().id("id").build())
                .projectUpdated(
                    AuditLogListResponse.ProjectUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ProjectUpdated.ChangesRequested.builder()
                                .title("title")
                                .build()
                        )
                        .build()
                )
                .rateLimitDeleted(AuditLogListResponse.RateLimitDeleted.builder().id("id").build())
                .rateLimitUpdated(
                    AuditLogListResponse.RateLimitUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.RateLimitUpdated.ChangesRequested.builder()
                                .batch1DayMaxInputTokens(0L)
                                .maxAudioMegabytesPer1Minute(0L)
                                .maxImagesPer1Minute(0L)
                                .maxRequestsPer1Day(0L)
                                .maxRequestsPer1Minute(0L)
                                .maxTokensPer1Minute(0L)
                                .build()
                        )
                        .build()
                )
                .roleAssignmentCreated(
                    AuditLogListResponse.RoleAssignmentCreated.builder()
                        .id("id")
                        .principalId("principal_id")
                        .principalType("principal_type")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .build()
                )
                .roleAssignmentDeleted(
                    AuditLogListResponse.RoleAssignmentDeleted.builder()
                        .id("id")
                        .principalId("principal_id")
                        .principalType("principal_type")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .build()
                )
                .roleCreated(
                    AuditLogListResponse.RoleCreated.builder()
                        .id("id")
                        .addPermission("string")
                        .resourceId("resource_id")
                        .resourceType("resource_type")
                        .roleName("role_name")
                        .build()
                )
                .roleDeleted(AuditLogListResponse.RoleDeleted.builder().id("id").build())
                .roleUpdated(
                    AuditLogListResponse.RoleUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.RoleUpdated.ChangesRequested.builder()
                                .description("description")
                                .metadata(JsonValue.from(mapOf<String, Any>()))
                                .addPermissionsAdded("string")
                                .addPermissionsRemoved("string")
                                .resourceId("resource_id")
                                .resourceType("resource_type")
                                .roleName("role_name")
                                .build()
                        )
                        .build()
                )
                .scimDisabled(AuditLogListResponse.ScimDisabled.builder().id("id").build())
                .scimEnabled(AuditLogListResponse.ScimEnabled.builder().id("id").build())
                .serviceAccountCreated(
                    AuditLogListResponse.ServiceAccountCreated.builder()
                        .id("id")
                        .data(
                            AuditLogListResponse.ServiceAccountCreated.Data.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .serviceAccountDeleted(
                    AuditLogListResponse.ServiceAccountDeleted.builder().id("id").build()
                )
                .serviceAccountUpdated(
                    AuditLogListResponse.ServiceAccountUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.ServiceAccountUpdated.ChangesRequested.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .userAdded(
                    AuditLogListResponse.UserAdded.builder()
                        .id("id")
                        .data(AuditLogListResponse.UserAdded.Data.builder().role("role").build())
                        .build()
                )
                .userDeleted(AuditLogListResponse.UserDeleted.builder().id("id").build())
                .userUpdated(
                    AuditLogListResponse.UserUpdated.builder()
                        .id("id")
                        .changesRequested(
                            AuditLogListResponse.UserUpdated.ChangesRequested.builder()
                                .role("role")
                                .build()
                        )
                        .build()
                )
                .build()

        val roundtrippedAuditLogListResponse =
            jsonMapper.readValue(
                jsonMapper.writeValueAsString(auditLogListResponse),
                jacksonTypeRef<AuditLogListResponse>(),
            )

        assertThat(roundtrippedAuditLogListResponse).isEqualTo(auditLogListResponse)
    }
}
