Issue:
Bug: adding dispute_id to Kafka events





Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
adding dispute id to hyperswitch-api-log-events


### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
check for dispute_id in topic = ```hyperswitch-api-log-events``` via loki

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable


Testing:

check for dispute_id in topic = ```hyperswitch-api-log-events``` via loki

Patch:
diff --git a/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql b/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql
index 0fe194a0e67..ad0fe6d778f 100644
--- a/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql
+++ b/crates/analytics/docs/clickhouse/cluster_setup/scripts/api_event_logs.sql
@@ -18,7 +18,8 @@ CREATE TABLE hyperswitch.api_events_queue on cluster '{cluster}' (
     `created_at` DateTime CODEC(T64, LZ4),
     `latency` Nullable(UInt128),
     `user_agent` Nullable(String),
-    `ip_addr` Nullable(String)
+    `ip_addr` Nullable(String),
+    `dispute_id` Nullable(String)
 ) ENGINE = Kafka SETTINGS kafka_broker_list = 'hyper-c1-kafka-brokers.kafka-cluster.svc.cluster.local:9092',
 kafka_topic_list = 'hyperswitch-api-log-events',
 kafka_group_name = 'hyper-c1',
@@ -81,7 +82,8 @@ CREATE TABLE hyperswitch.api_events_dist on cluster '{cluster}' (
     `created_at` DateTime64(3),
     `latency` Nullable(UInt128),
     `user_agent` Nullable(String),
-    `ip_addr` Nullable(String)
+    `ip_addr` Nullable(String),
+    `dispute_id` Nullable(String)
 ) ENGINE = Distributed('{cluster}', 'hyperswitch', 'api_events_clustered', rand());
 
 CREATE MATERIALIZED VIEW hyperswitch.api_events_mv on cluster '{cluster}' TO hyperswitch.api_events_dist (
@@ -105,7 +107,8 @@ CREATE MATERIALIZED VIEW hyperswitch.api_events_mv on cluster '{cluster}' TO hyp
     `created_at` DateTime64(3),
     `latency` Nullable(UInt128),
     `user_agent` Nullable(String),
-    `ip_addr` Nullable(String)
+    `ip_addr` Nullable(String),
+    `dispute_id` Nullable(String)
 ) AS
 SELECT
     merchant_id,
@@ -158,7 +161,7 @@ WHERE length(_error) > 0
 
 ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `url_path` LowCardinality(Nullable(String));
 ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `event_type` LowCardinality(Nullable(String));
-
+ALTER TABLE hyperswitch.api_events_clustered on cluster '{cluster}' ADD COLUMN `dispute_id` Nullable(String);
 
 CREATE TABLE hyperswitch.api_audit_log ON CLUSTER '{cluster}' (
     `merchant_id` LowCardinality(String),
@@ -209,7 +212,8 @@ CREATE MATERIALIZED VIEW hyperswitch.api_audit_log_mv ON CLUSTER `{cluster}` TO
     `created_at` DateTime64(3),
     `latency` Nullable(UInt128),
     `user_agent` Nullable(String),
-    `ip_addr` Nullable(String)
+    `ip_addr` Nullable(String),
+    `dispute_id` Nullable(String)
 ) AS 
 SELECT 
     merchant_id,
@@ -232,6 +236,7 @@ SELECT
     created_at,
     latency,
     user_agent,
-    ip_addr
+    ip_addr,
+    dispute_id
 FROM hyperswitch.api_events_queue
 WHERE length(_error) = 0
\ No newline at end of file
diff --git a/crates/analytics/docs/clickhouse/scripts/api_events.sql b/crates/analytics/docs/clickhouse/scripts/api_events.sql
index c3fc3d7b06d..49a6472eaa4 100644
--- a/crates/analytics/docs/clickhouse/scripts/api_events.sql
+++ b/crates/analytics/docs/clickhouse/scripts/api_events.sql
@@ -23,7 +23,8 @@ CREATE TABLE api_events_queue (
     `ip_addr` String,
     `hs_latency` Nullable(UInt128),
     `http_method` LowCardinality(String),
-    `url_path` String
+    `url_path` String,
+    `dispute_id` Nullable(String)
 ) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
 kafka_topic_list = 'hyperswitch-api-log-events',
 kafka_group_name = 'hyper-c1',
@@ -57,6 +58,7 @@ CREATE TABLE api_events_dist (
     `hs_latency` Nullable(UInt128),
     `http_method` LowCardinality(String),
     `url_path` String,
+    `dispute_id` Nullable(String)
     INDEX flowIndex flow_type TYPE bloom_filter GRANULARITY 1,
     INDEX apiIndex api_flow TYPE bloom_filter GRANULARITY 1,
     INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1
@@ -92,7 +94,8 @@ CREATE MATERIALIZED VIEW api_events_mv TO api_events_dist (
     `ip_addr` String,
     `hs_latency` Nullable(UInt128),
     `http_method` LowCardinality(String),
-    `url_path` String
+    `url_path` String,
+    `dispute_id` Nullable(String)
 ) AS
 SELECT
     merchant_id,
@@ -120,7 +123,8 @@ SELECT
     ip_addr,
     hs_latency,
     http_method,
-    url_path
+    url_path,
+    dispute_id
 FROM
     api_events_queue
 where length(_error) = 0;
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index a8185d2d241..ae0525ac609 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -1,5 +1,6 @@
 pub mod connector_onboarding;
 pub mod customer;
+pub mod dispute;
 pub mod gsm;
 mod locker_migration;
 pub mod payment;
@@ -44,8 +45,6 @@ impl_misc_api_event_type!(
     RetrievePaymentLinkResponse,
     MandateListConstraints,
     CreateFileResponse,
-    DisputeResponse,
-    SubmitEvidenceRequest,
     MerchantConnectorResponse,
     MerchantConnectorId,
     MandateResponse,
diff --git a/crates/api_models/src/events/dispute.rs b/crates/api_models/src/events/dispute.rs
new file mode 100644
index 00000000000..101dba3ca02
--- /dev/null
+++ b/crates/api_models/src/events/dispute.rs
@@ -0,0 +1,25 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use super::{DisputeResponse, DisputeResponsePaymentsRetrieve, SubmitEvidenceRequest};
+
+impl ApiEventMetric for SubmitEvidenceRequest {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Dispute {
+            dispute_id: self.dispute_id.clone(),
+        })
+    }
+}
+impl ApiEventMetric for DisputeResponsePaymentsRetrieve {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Dispute {
+            dispute_id: self.dispute_id.clone(),
+        })
+    }
+}
+impl ApiEventMetric for DisputeResponse {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Dispute {
+            dispute_id: self.dispute_id.clone(),
+        })
+    }
+}
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index c2bf50d96c3..e755e0f9c4c 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -50,6 +50,9 @@ pub enum ApiEventsType {
     RustLocker,
     FraudCheck,
     Recon,
+    Dispute {
+        dispute_id: String,
+    },
 }
 
 impl ApiEventMetric for serde_json::Value {}
diff --git a/crates/router/src/events/api_logs.rs b/crates/router/src/events/api_logs.rs
index 78a66d2f04e..3d74a028840 100644
--- a/crates/router/src/events/api_logs.rs
+++ b/crates/router/src/events/api_logs.rs
@@ -114,7 +114,6 @@ impl_misc_api_event_type!(
     CreateFileRequest,
     FileId,
     AttachEvidenceRequest,
-    DisputeId,
     PaymentLinkFormData,
     ConfigUpdate
 );
@@ -142,3 +141,11 @@ impl ApiEventMetric for PaymentsRedirectResponseData {
         })
     }
 }
+
+impl ApiEventMetric for DisputeId {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Dispute {
+            dispute_id: self.dispute_id.clone(),
+        })
+    }
+}