# ============================================================================
# Sian SDK Consumer ProGuard/R8 Rules
# These rules are bundled with the AAR and applied during app build time.
# ============================================================================

# Suppress warnings for Java 9+ string concatenation
-dontwarn java.lang.invoke.StringConcatFactory

# D1 4.4.0 no longer bundles the Samsung Pay SDK (4.3.0 and earlier did), and its Samsung code paths
# still reference those classes. Sian now bundles samsungpay.jar (2.17.00, from the same Thales
# distribution) in the AAR's libs/, so the classes resolve. Kept as a safety net for consumers who
# strip it: this SDK only provisions to Google Pay (OEMPayType.GOOGLE_PAY), so they are never loaded.
-dontwarn com.samsung.android.sdk.samsungpay.**

# Keep public API entry points
-keep class com.checkout.cardnetwork.CheckoutCardService { *; }
-keep class com.checkout.cardnetwork.CardService { public *; }

# Keep all public model classes and their members
-keep class com.checkout.cardnetwork.common.model.** { *; }
-keep class com.checkout.cardnetwork.data.dto.** { *; }
-keep class com.checkout.cardnetwork.data.core.CardDigitizationState { *; }
-keep class com.checkout.cardnetwork.data.core.ProvisioningConfiguration { *; }

# Keep NetworkLogger interface
-keep interface com.checkout.cardnetwork.common.NetworkLogger { *; }

# Keep Dagger-generated component
-keep class com.checkout.cardnetwork.di.DaggerCoreComponent { *; }
-keep class com.checkout.cardnetwork.di.DaggerCoreComponent$Builder { *; }

# Keep Gson serialized fields (scoped to SDK package only)
# allowobfuscation is safe because Gson uses @SerializedName annotation values, not field names
-keepclassmembers,allowobfuscation class com.checkout.cardnetwork.** {
    @com.google.gson.annotations.SerializedName <fields>;
}

# Keep enum values for Gson deserialization
# Only keep essential methods; enum constants are preserved by the class keeps above
-keepclassmembers,allowobfuscation enum com.checkout.cardnetwork.** {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
