# Consumer ProGuard rules for pxpcheckout module
# Bundled as proguard.txt in the release AAR for merchant apps using minifyEnabled true

# Stack traces
-keepattributes SourceFile,LineNumberTable

# SDK entry points (outside com.pxp.checkout)
-keep class com.pxp.PxpCheckout { *; }
-keep class com.pxp.PxpCheckout$* { *; }
-keep class com.pxp.BasePxpCheckout { *; }

# Public merchant-facing API
-keep public class com.pxp.checkout.** { public *; }

# Internal SDK components (3DS WebView, PayPal OAuth, etc.)
-keep class com.pxp.checkout.components.** { *; }

# Analytics — preserve JVM field names for Gson JSON (all events under analytics.*)
-keepclassmembers class com.pxp.checkout.analytics.** {
    <fields>;
}

# WebView JavaScript bridges (PayPal, 3DS fingerprint)
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

# Factory / DI wiring
-keep class com.pxp.checkout.factory.ComponentFactory { *; }
-keep class com.pxp.checkout.di.** { *; }

# Kotlin
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.**

# Gson — preserve field names for JSON (de)serialization inside the SDK
-keepattributes Signature, InnerClasses, EnclosingMethod
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepclassmembers,allowobfuscation class * {
    @com.google.gson.annotations.SerializedName <fields>;
}

# Unity API request/response bodies
-keep class com.pxp.checkout.services.models.** { *; }
-keep class com.pxp.checkout.models.** { *; }

# Checkout drop-in site config (configurations, authorisation-evaluation)
-keep class com.pxp.checkout.checkoutdropin.types.** { *; }

# Kount risk screening payloads and Unity 3DS auth payloads
-keep class com.pxp.checkout.services.kount.** { *; }
-keep class com.pxp.checkout.services.unityServices.types.** { *; }

# HTTP error envelope and Gson type adapters
-keep class com.pxp.checkout.services.network.ErrorResponse { *; }
-keep class com.pxp.checkout.services.network.GsonProvider { *; }
-keep class com.pxp.checkout.services.network.**TypeAdapter* { *; }
-keep class com.pxp.checkout.services.network.**Serializer* { *; }
-keep class com.pxp.checkout.services.network.**Deserializer* { *; }

# Component-layer Gson payloads
-keep class com.pxp.checkout.components.paze.types.** { *; }
-keep class com.pxp.checkout.components.cardsubmit.types.** { *; }

-keep class com.google.gson.** { *; }
-dontwarn com.google.gson.**

# Retrofit / OkHttp
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keep class retrofit2.** { *; }
-keep class okhttp3.** { *; }
-dontwarn retrofit2.**
-dontwarn okhttp3.**

# Coroutines
-keep class kotlinx.coroutines.** { *; }
-dontwarn kotlinx.coroutines.**

# Compose
-keep @androidx.compose.runtime.Composable class com.pxp.checkout.** { *; }
-keep class androidx.compose.** { *; }
-dontwarn androidx.compose.**

# AndroidX
-keep class androidx.** { *; }
-dontwarn androidx.**

# Koin (SDK internal DI)
-keep class org.koin.** { *; }
-dontwarn org.koin.**

# Aerosync Bank Link SDK (Aeropay)
-keepclassmembers class com.aerosync.bank_link_sdk.EventListener {
    public *;
}
-dontwarn com.aerosync.**

# Kount fraud SDK
-keep class com.kount.** { *; }
-dontwarn com.kount.**

# Google Pay
-keep class com.google.android.gms.wallet.** { *; }
-dontwarn com.google.android.gms.**

# BuildConfig (URLs injected at SDK build time)
-keep class com.pxp.checkout.BuildConfig { *; }
