# ChottuLink SDK - Consumer ProGuard Rules (applied in app builds)
# These rules are packaged into the AAR via consumerProguardFiles and are applied
# when an app that depends on this SDK is minified.
#
# IMPORTANT:
# - DO NOT include -repackageclasses here. Doing so can repackage the app and other
#   dependencies into ChottuLink's namespace, making stack traces misleading and
#   potentially impacting unrelated libraries.

# Keep line number information where possible for stack traces.
-keepattributes SourceFile,LineNumberTable

# Keep SDK model classes (used with Gson) and all their members to ensure JSON deserialization works.
-keep class com.chottulink.lib.network.ChottuApiClient$* { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$ResolveLinkResponse { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$CreateLinkResponse { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$AttributionResponse { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$GenericResponse { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$BatchResponse { *; }
-keep class com.chottulink.lib.network.ChottuApiClient$HTTPException { *; }
-keep class com.chottulink.lib.ChottuLink { *; }
-keep class com.chottulink.lib.ChottuLink$OnSuccessListener { *; }
-keep class com.chottulink.lib.ChottuLink$OnFailureListener { *; }
-keep class com.chottulink.lib.ChottuLink$AppLinkData { *; }
-keep class com.chottulink.lib.ChottuLink$ChottuLinkTask { *; }
-keep class com.chottulink.lib.ChottuLink$AttributionData { *; }
-keep class com.chottulink.lib.ChottuLink$CustomerMeta { *; }
-keep class com.chottulink.lib.ChottuLink$CustomerMeta$Builder { *; }
-keep class com.chottulink.lib.ChottuLink$LeadMeta { *; }
-keep class com.chottulink.lib.ChottuLink$LeadMeta$Builder { *; }
-keep class com.chottulink.lib.ChottuLink$ConversionMeta { *; }
-keep class com.chottulink.lib.ChottuLink$ConversionMeta$Builder { *; }
-keep class com.chottulink.lib.DynamicLink { *; }
-keep class com.chottulink.lib.DynamicLink$Builder { *; }
-keep class com.chottulink.lib.config.ChottuConfig { *; }

# Event Queue (vendored from Segment analytics-android, MIT license)
-keep class com.chottulink.lib.queue.QueueFile { *; }
-keep class com.chottulink.lib.queue.PayloadQueue { *; }
-keep class com.chottulink.lib.queue.PayloadQueue$PersistentQueue { *; }
-keep class com.chottulink.lib.queue.PayloadQueue$MemoryQueue { *; }
-keep class com.chottulink.lib.queue.EventQueue { *; }

# --- Rules for OkHttp3 ---
-keepattributes Signature
-keepattributes InnerClasses
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.** # OkHttp depends on Okio

# --- Rules for Gson ---
-keepclassmembers,allowobfuscation class * {
    @com.google.gson.annotations.SerializedName <fields>;
}
-keep public class java.util.List { *; }
-keep public class java.util.Map { *; }
-keep class com.google.gson.TypeAdapter { *; }
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.TypeAdapter
-keep class * extends com.google.gson.reflect.TypeToken

