package auditlog

const (
	HeaderAuthorizationGRPC = "authorization"
	TokenTypeBearer         = "bearer"
	HeaderAuthorizationGIN  = "Authorization"
	HeaderXForwardedFor     = "X-Forwarded-For"
	HeaderXAuthType         = "X-Auth-Type"
	HeaderXAuthContent      = "X-Auth-Content"
	HeaderXAuthRaw          = "X-Auth-Raw"
	HeaderXAuthMethod       = "X-Auth-Method"
)

const (
	EventBusAppName = "auditlog"
	EventBusGroup   = "consumer"

	EventBusEventType = "auditlog"
)

const (
	OperatorTypeUnknown OperatorType = iota
	OperatorTypeUser
	OperatorTypeAPIKey
	OperatorTypeAccessToken
	OperatorTypeSystem
)

const (
	ResultUnknown Result = iota
	ResultSuccess
	ResultFailed
)

const (
	ClusterTypeUnknown ClusterType = iota
	ClusterTypeServerless
	ClusterTypeDedicated
)

// types defined in doc: https://pingcap.feishu.cn/wiki/wikcnNLaLvAkEJ3DPOGTPXImKAd
// !!! notice：The new event must be at the end
const (
	EventUnknown EventType = iota
	EventRegistration
	EventActivation
	EventForgotPassword
	EventResetPassword
	EventLogin
	EventLogout
	EventUpdateProfile
	EventSetMFA
	EventChangePassword
	EventCreateOrg
	EventLoginOrg
	EventSwitchOrg
	EventLogoutOrg
	EventInviteUserToOrg
	EventDeleteInvitationToOrg
	EventResendInvitationToOrg
	EventConfirmJoinOrg
	EventDeleteUserFromOrg
	EventUpdateUserRole
	EventCreateAPIKey
	EventEditAPIKey
	EventDeleteAPIKey
	EventUpdateTimezone
	EventShowBill
	EventDownloadBill
	EventShowCredits
	EventAddPaymentCard
	EventUpdatePaymentCard
	EventDeletePaymentCard
	EventSetDefaultPaymentCard
	EventEditBillingProfile
	EventContractAction
	EventEnableConsoleAuditLog
	EventShowConsoleAuditLog
	EventInviteUserToProject
	EventDeleteInvitationToProject
	EventResendInvitationToProject
	EventConfirmJoinProject
	EventDeleteUserFromProject
	EventCreateProject
	EventCreateProjectCIDR
	EventCreateAWSVPCPeering
	EventDeleteAWSVPCPeering
	EventCreateGCPVPCPeering
	EventDeleteGCPVPCPeering
	EventCreatePrivateEndpoint
	EventEditPrivateEndpoint
	EventDeletePrivateEndpoint
	EventSubscribeAlerts
	EventUnsubscribeAlerts
	EventCreateDatadogIntegration
	EventDeleteDatadogIntegration
	CreateVercelIntegration
	DeleteVercelIntegration
	CreatePrometheusIntegration
	DeletePrometheusIntegration
	EventCreateCluster
	EventCreateAWSDedicatedCluster // Deprecated
	EventCreateGCPDedicatedCluster // Deprecated
	EventDeleteCluster
	EventPauseCluster
	EventResumeCluster
	EventScaleCluster
	EventDownloadTiDBClusterCA
	EventOpenWebSQLConsole
	EventSetRootPassword
	EventUpdateIPAccessList
	EventDeleteAccessList
	EventSetAutoBackup
	EventDoManualBackup
	EventDeleteBackupTask
	EventDeleteBackup
	EventRecoverFromBackup
	EventRecoverFromTrash
	EventImportDataFromAWS
	EventImportDataFromGCP
	EventCreateMigrationJob
	EventSuspendMigrationJob
	EventResumeMigrationJob
	EventDeleteMigrationJob
	EventShowDiagnose
	EventDBAuditLogAction
	EventAddDBAuditFilter
	EventDeleteDBAuditFilter
	EventEditProject
	EventDeleteProject
	EventBindSupportPlan
	EventCancelSupportPlan
	EventUpdateOrgName
	EventCreatePrivateEndpointService
	EventDeletePrivateEndpointService
	EventImportDataFromLocal
	EventCreateNewrelicIntegration
	EventDeleteNewrelicIntegration
	EventUpdateAlertRule
	EventSetServerlessSpendLimit
	EventUpdateMaintenanceWindow
	EventDeferMaintenanceTask
	EventEnableCloudOrganizationSSO
	EventEnableAuthenticationMethod
	EventDisableAuthenticationMethod
	EventUpdateAuthenticationMethod
	EventEnterChat2Query
	EventConsoleChat2SQLFromChat2Query
	EventConsoleQuerySQLFromChat2Query
	EventCreateSQLFileFromChat2Query
	EventDeleteSQLFileFromChat2Query
	EventCreateBranch
	EventDeleteBranch
	EventSetBranchRootPassword
	EventCreateSQLUser
	EventUpdateSQLUser
	EventDeleteSQLUser
	EventConnectBranchGitHub
	EventDisconnectBranchGitHub
	EventUpdateCluster
	EventCreateAccesspoint // Deprecated
	EventUpdateAccesspoint // Deprecated
	EventDeleteAccesspoint // Deprecated
	EventRestoreFromPITR
	EventUpdateProjectCIDR
	EventDeleteProjectCIDR
	EventResetBranch
	EventCreateTidbNodeGroup
	EventUpdateTidbNodeGroup
	EventDeleteTidbNodeGroup
	EventImportDataFromAzure
	EventUpdateBranch
	EventUpdateLogRedactionPolicy
	EventBackupCompleted
	EventUpdateAuditLogConfig
	EventGenerateAuditLogFileDownloadAddress
	EventCreateAuditLogFilterRule
	EventUpdateAuditLogFilterRule
	EventDeleteAuditLogFilterRule
	EventCreateMetricsIntegration
	EventDeleteMetricsIntegration
	EventCreateTiDB
	EventDeleteTiDB
	EventUpdateTiDB
	EventUpdatePublicConnection
	EventUpdateUserRoleInProject
	EventInviteUserToTiDB
	EventUpdateUserRoleInTiDB
	EventDeleteInvitationToTiDB
	EventDeleteUserFromTiDB
	EventImportDataFromAlibabaCloud
	EventImportDataCanceled
	EventMoveCluster
	EventBatchMoveCluster
	EventApproveProjectMigration
	EventEnableDualLayerDataEncryption
	EventDownloadQueryResultFromChat2Query
	EventExportDataToLocal
	EventExportDataToAWS // S3
	EventExportDataToGCP
	EventExportDataToAzure
	EventExportDataToAlibabaCloud // OSS
	EventExportDataCanceled
	EventExportDataDeleted
	EventCreatePrivateEndpointForExternalService
	EventDeletePrivateEndpointForExternalService
	EventAttachPrivateEndpointForExternalServiceDomains
	EventDetachPrivateEndpointForExternalServiceDomains
	EventCreateChangefeed
	EventEditChangefeed
	EventDeleteChangefeed
	EventStartChangefeed
	EventStopChangefeed
	EventScaleChangefeed
	EventCreateResourcePool
	EventUpdateResourcePool
	EventDeleteResourcePool
	EventResizeResourcePoolCapacity
	EventUpdateResourcePoolCloudResourceTags
)

const (
	TagAuditLogRejected       = "AUDIT_LOG_REJECTED"
	TagAuditLogSubmitFailed   = "AUDIT_LOG_SUBMIT_FAILED"
	TagAuditLogExtendFailed   = "AUDIT_LOG_EXTEND_FAILED"
	TagAuditLogSubmitRejected = "AUDIT_LOG_SUBMIT_REJECTED"
)

// !!! notice：The new key field must be at the end
const (
	KeyAccessType                          = "access_type"
	KeyActions                             = "actions"
	KeyAddress1                            = "address1"
	KeyAddress2                            = "address2"
	KeyApiKey                              = "api_key"
	KeyApplicationGcpProjectId             = "application_gcp_project_id"
	KeyAwsAccountId                        = "aws_account_id"
	KeyBackupCycle                         = "backup_cycle"
	KeyBackupName                          = "backup_name"
	KeyBackupRetention                     = "backup_retention"
	KeyBackupStatus                        = "backup_status"
	KeyBackupStorageRegion                 = "backup_storage_region"
	KeyBackupTime                          = "backup_time"
	KeyBackupType                          = "backup_type"
	KeyBucketRegion                        = "bucket_region"
	KeyBucketUri                           = "bucket_uri"
	KeyCardNumber                          = "card_number"
	KeyCity                                = "city"
	KeyCloudProvider                       = "cloud_provider"
	KeyCompanyName                         = "company_name"
	KeyContractId                          = "contract_id"
	KeyCountryOrRegion                     = "country_or_region"
	KeyCreatedTime                         = "created_time"
	KeyCvcOrCvv                            = "cvc_or_cvv"
	KeyDatabase                            = "database"
	KeyDataFormat                          = "data_format"
	KeyDescription                         = "description"
	KeyEnableOrDisable                     = "enable_or_disable"
	KeyEndpoint                            = "endpoint"
	KeyEndpointService                     = "endpoint_service"
	KeyEndpointServiceStatus               = "endpoint_service_status"
	KeyEndpointStatus                      = "endpoint_status"
	KeyExpirationDate                      = "expiration_date"
	KeyFirstName                           = "first_name"
	KeyImportStatus                        = "import_status"
	KeyIntegrationType                     = "integration_type"
	KeyIpAddress                           = "ip_address"
	KeyJobName                             = "job_name"
	KeyLastName                            = "last_name"
	KeyLocation                            = "location"
	KeyMigrationId                         = "migration_id"
	KeyMigrationJobType                    = "migration_job_type"
	KeyMigrationObject                     = "migration_object"
	KeyMigrationStatus                     = "migration_status"
	KeyNameOnCard                          = "name_on_card"
	KeyNewDescription                      = "new_description"
	KeyNewFirstName                        = "new_first_name"
	KeyNewLastName                         = "new_last_name"
	KeyNewPhoneNumber                      = "new_phone_number"
	KeyNewProjectName                      = "new_project_name"
	KeyNewRole                             = "new_role"
	KeyNewTidbQuantity                     = "new_tidb_quantity"
	KeyNewTidbSize                         = "new_tidb_size"
	KeyNewTiflashQuantity                  = "new_tiflash_quantity"
	KeyNewTiflashSize                      = "new_tiflash_size"
	KeyNewTiflashStorageSize               = "new_tiflash_storage_size"
	KeyNewTikvQuantity                     = "new_tikv_quantity"
	KeyNewTikvSize                         = "new_tikv_size"
	KeyNewTikvStorageSize                  = "new_tikv_storage_size"
	KeyNewTikvStorageType                  = "new_tikv_storage_type"
	KeyNewTikvDataStoreIops                = "new_tikv_data_store_iops"
	KeyNewTimezone                         = "new_timezone"
	KeyOldDescription                      = "old_description"
	KeyOldFirstName                        = "old_first_name"
	KeyOldLastName                         = "old_last_name"
	KeyOldPhoneNumber                      = "old_phone_number"
	KeyOldProjectName                      = "old_project_name"
	KeyOldRole                             = "old_role"
	KeyOldTidbQuantity                     = "old_tidb_quantity"
	KeyOldTidbSize                         = "old_tidb_size"
	KeyOldTiflashQuantity                  = "old_tiflash_quantity"
	KeyOldTiflashSize                      = "old_tiflash_size"
	KeyOldTiflashStorageSize               = "old_tiflash_storage_size"
	KeyOldTikvQuantity                     = "old_tikv_quantity"
	KeyOldTikvSize                         = "old_tikv_size"
	KeyOldTikvStorageSize                  = "old_tikv_storage_size"
	KeyOldTikvStorageType                  = "old_tikv_storage_type"
	KeyOldTikvDataStoreIops                = "old_tikv_data_store_iops"
	KeyOldTimezone                         = "old_timezone"
	KeyPayMethodId                         = "pay_method_id"
	KeyPeeringId                           = "peering_id"
	KeyPhoneNumber                         = "phone_number"
	KeyPortNumber                          = "port_number"
	KeyProjectCidr                         = "project_cidr"
	KeyRegion                              = "region"
	KeyRestoreClusterName                  = "restore_cluster_name"
	KeyRestoreRegion                       = "restore_region"
	KeyRole                                = "role"
	KeyRoleArn                             = "role_arn"
	KeySignupMethod                        = "signup_method"
	KeySite                                = "site"
	KeySourceConnectivityMethod            = "source_connectivity_method"
	KeySourceDataSource                    = "source_data_source"
	KeySourceEnableTls                     = "source_enable_tls"
	KeySourceFileName                      = "source_file_name"
	KeySourceHostnameOrIpaddress           = "source_hostname_or_ipaddress"
	KeySourcePort                          = "source_port"
	KeySourceRegion                        = "source_region"
	KeySourceTableName                     = "source_table_name"
	KeySourceUsername                      = "source_username"
	KeyStateOrProvince                     = "state_or_province"
	KeyStatus                              = "status"
	KeySubnetIds                           = "subnet_ids"
	KeySubscriber                          = "subscriber"
	KeyTable                               = "table"
	KeyTableFilter                         = "table_filter"
	KeyTargetClusterId                     = "target_cluster_id"
	KeyTargetClusterName                   = "target_cluster_name"
	KeyTargetRegion                        = "target_region"
	KeyTargetTableName                     = "target_table_name"
	KeyTargetUsername                      = "target_username"
	KeyTidbCloudCidr                       = "tidb_cloud_cidr"
	KeyTidbProjectId                       = "tidb_project_id"
	KeyTidbQuantity                        = "tidb_quantity"
	KeyTidbSize                            = "tidb_size"
	KeyTidbVpcNetworkName                  = "tidb_vpc_network_name"
	KeyTiflashQuantity                     = "tiflash_quantity"
	KeyTiflashSize                         = "tiflash_size"
	KeyTiflashStorageSize                  = "tiflash_storage_size"
	KeyTikvStorageType                     = "tikv_storage_type"
	KeyTikvDataStoreIops                   = "tikv_data_store_iops"
	KeyTikvQuantity                        = "tikv_quantity"
	KeyTikvSize                            = "tikv_size"
	KeyTikvStorageSize                     = "tikv_storage_size"
	KeyUpdateCaCertificate                 = "update_ca_certificate"
	KeyUpdateClientCertificate             = "update_client_certificate"
	KeyUpdateClientPrivateKey              = "update_client_private_key"
	KeyUser                                = "user"
	KeyUserEmail                           = "user_email"
	KeyVatOrGstId                          = "vat_or_gst_id"
	KeyVpcCidr                             = "vpc_cidr"
	KeyVpcEndpointId                       = "vpc_endpoint_id"
	KeyVpcId                               = "vpc_id"
	KeyVpcNetworkName                      = "vpc_network_name"
	KeyZipOrPostalCode                     = "zip_or_postal_code"
	KeyError                               = "error"
	KeyProjectName                         = "project_name"
	KeyDBAuditLogID                        = "db_audit_log_id"
	KeyIPAddress                           = "ip_address"
	KeyOldOrgName                          = "old_org_name"
	KeyNewOrgName                          = "new_org_name"
	KeyTrafficFilterList                   = "traffic_filter_list"
	KeyTierType                            = "tier_type"
	KeyRestart                             = "restart"
	KeyAlertRuleNewStatus                  = "alertrule_new_status"
	KeyAlertRuleNewThreshold               = "alertrule_new_threshold"
	KeyAlertRuleNewTriggerInterval         = "alertrule_new_trigger_interval"
	KeyAlertRuleOldThreshold               = "alertrule_old_threshold"
	KeyAlertRuleOldTriggerInterval         = "alertrule_old_trigger_interval"
	KeyDayOfWeek                           = "day_of_week"
	KeyHourOfDay                           = "hour_of_day"
	KeyMaintenanceTaskId                   = "maintenance_task_id"
	KeyAuthenticationMethodName            = "method_name"
	KeyOldValue                            = "old"
	KeyNewValue                            = "new"
	KeyBranchID                            = "branch_id"
	KeyBranchName                          = "branch_name"
	KeySqlUserName                         = "user_name"
	KeyGitHubRepoName                      = "github_repo_name"
	KeySpendingLimit                       = "spending_limit"
	KeyAdvancedEncryption                  = "advanced_encryption"
	KeyUpdateMask                          = "update_mask"
	KeyUpdateValue                         = "update_value"
	KeyEnhancedEncryption                  = "enhanced_encryption"
	KeyAccesspointID                       = "accesspoint_id"
	KeyDisplayName                         = "display_name"
	KeyEndpointID                          = "endpoint_id"
	KeyEndpointName                        = "endpoint_name"
	KeyIPAllowlist                         = "ip_allowlist"
	KeyTidbNodeQuantity                    = "tidb_node_quantity"
	KeyBackupID                            = "backup_id"
	KeyRestoreID                           = "restore_id"
	KeyRestoreMode                         = "restore_mode"
	KeyRestoreTo                           = "restore_to"
	KeyRegionCIDR                          = "region_cidr"
	KeyOldRegionCIDR                       = "old_region_cidr"
	KeyNewRegionCIDR                       = "new_region_cidr"
	KeyTidbNodeGroupId                     = "tidb_node_group_id"
	KeyBranchNewName                       = "branch_new_name"
	KeyTiProxyQuantity                     = "tiproxy_quantity"
	KeyTiProxySize                         = "tiproxy_size"
	KeyNewTiProxyQuantity                  = "new_tiproxy_quantity"
	KeyNewTiProxySize                      = "new_tiproxy_size"
	KeyOldTiProxyQuantity                  = "old_tiproxy_quantity"
	KeyOldTiProxySize                      = "old_tiproxy_size"
	KeyNewLogRedactionPolicy               = "new_log_redaction_policy"
	KeyOldLogRedactionPolicy               = "old_log_redaction_policy"
	KeyGeneralContent                      = "content"
	KeyMinRcu                              = "min_rcu"
	KeyMaxRcu                              = "max_rcu"
	KeyNewMinRcu                           = "new_min_rcu"
	KeyNewMaxRcu                           = "new_max_rcu"
	KeyNewClusterName                      = "new_name"
	KeyOldMinRcu                           = "old_min_rcu"
	KeyOldMaxRcu                           = "old_max_rcu"
	KeyOldClusterName                      = "old_name"
	KeyEnabled                             = "enabled"
	KeyServicePlan                         = "service_plan"
	KeyAction                              = "action"
	KeyPublicEndpoint                      = "public_endpoint"
	KeyExportID                            = "export_id"
	KeyImportID                            = "import_id"
	KeyPrivateEndpointForExternalServiceId = "private_endpoint_for_external_service_id"
	KeyAttachDomainId                      = "attach_domain_id"
	KeyMskArn                              = "msk_arn"
	KeyChangefeedId                        = "changefeed_id"
	KeyChangefeedType                      = "changefeed_type"
	KeyNetworkType                         = "network_type"
	KeyEndpointZones                       = "endpoint_zones"
	KeyImportMode                          = "import_mode"
	KeyDownstreamId                        = "downstream_id"
	KeyResourcePoolId                      = "resource_pool_id"
	KeyHighAvailabilityType                = "high_availability_type"
	KeyVcpuLimit                           = "vcpu_limit"
	KeyCapacity                            = "capacity"
	KeyCreatedBy                           = "created_by"
	KeyChangedTagKeys                      = "changed_tag_keys"
	KeyRemovedTagKeys                      = "removed_tag_keys"
	KeyOldTagCount                         = "old_tag_count"
	KeyNewTagCount                         = "new_tag_count"
)
