# ============================================================================
# Gate2 Travel SDK - Core Consumer ProGuard Rules
# ============================================================================
# Applied automatically to host apps that depend on the shared core (directly or
# transitively via a feature module). The core AAR ships UNMINIFIED; the host
# app's R8 obfuscates the whole graph. These rules keep the host-facing public
# API and the reflection / Gson surfaces; everything else may be obfuscated.

# ============================================================================
# PUBLIC API — Core
# ============================================================================

# Main SDK entry point (host calls initialize, updateTheme, etc.)
-keep public class com.gate2.sdk.core.Gate2TravelSdk { *; }
-keep public class com.gate2.sdk.core.Gate2TravelSdk$Companion { *; }

# SDK / theme configuration (host constructs these via builders)
-keep public class com.gate2.sdk.core.config.** { *; }

# Payment API (host receives these via callbacks)
-keep public class com.gate2.sdk.core.api.PaymentRequest { *; }
-keep public class com.gate2.sdk.core.api.PaymentResult { *; }
-keep public class com.gate2.sdk.core.api.PaymentResult$* { *; }

# Module system (needed for reflection-based loading + host queries)
-keep public class com.gate2.sdk.core.module.ModuleId { *; }
-keep public class com.gate2.sdk.core.module.SdkModule { *; }
-keep public class * implements com.gate2.sdk.core.module.SdkModule { *; }

# Design system (host may reference for theming)
-keep public class com.gate2.sdk.core.design.Gate2Colors { *; }

# Theme composable entry (alternative to Activity-based flows)
-keep class com.gate2.sdk.core.ui.theme.Gate2ComposeThemeKt {
    public static void Gate2TravelTheme(...);
}

# ============================================================================
# RETROFIT & GSON
# ============================================================================
-keepattributes Signature
-keepattributes Exceptions
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }

# Gson: keep model field names for JSON while allowing class obfuscation
-keepclassmembers,allowobfuscation class com.gate2.sdk.core.**.model.** {
    <fields>;
}
-keepclassmembers class * {
    @com.google.gson.annotations.SerializedName <fields>;
}

# ============================================================================
# OKHTTP / COIL / KOTLIN
# ============================================================================
-dontwarn okhttp3.**
-dontwarn okio.**
-keep class okhttp3.** { *; }
-keep class okio.** { *; }

-keep class coil3.** { *; }
-dontwarn coil3.**

# Kotlin reflection (module registration)
-keep class kotlin.reflect.** { *; }
-dontwarn kotlin.reflect.**

-keepattributes RuntimeVisibleAnnotations
-dontwarn org.bouncycastle.**
-dontwarn org.conscrypt.**
-dontwarn org.openjsse.**
-dontwarn java.lang.invoke.**
