##
## Purse Vault SDK — consumer R8 / ProGuard rules
## Bundled into the AAR and applied automatically to any app that depends on this library.
##

# ── Public API surface ────────────────────────────────────────────────────────
# Merchant code references these by name. Renaming or removing them causes
# compile-time or runtime failures in the host app.

-keep public class eu.purse.securefields.SecureFieldsAndroid { *; }
-keep public class eu.purse.securefields.VaultFieldView { *; }
-keep public class eu.purse.securefields.SecureFieldsException { *; }
-keep public class eu.purse.securefields.model.** { *; }
-keep public class eu.purse.securefields.events.** { *; }
-keep public class eu.purse.securefields.config.** { *; }

# ── Listener interface ────────────────────────────────────────────────────────
# Merchant implementations of SecureFieldsListener must survive R8. The interface
# itself and all its method signatures must be kept so overrides are not stripped.

-keep public interface eu.purse.securefields.SecureFieldsListener { *; }
-keep class * implements eu.purse.securefields.SecureFieldsListener { *; }

# ── Internal field views ──────────────────────────────────────────────────────
# Instantiated at runtime by NativeFieldsManager. Declared `internal` so they
# are invisible to merchant code; R8 may treat them as unreachable and remove them.
# Only the constructors need to survive — the rest can be optimised normally.

-keep class eu.purse.securefields.internal.CardNumberEditText { <init>(...); }
-keep class eu.purse.securefields.internal.ExpiryEditText     { <init>(...); }
-keep class eu.purse.securefields.internal.CvvEditText        { <init>(...); }
-keep class eu.purse.securefields.internal.HolderNameEditText { <init>(...); }

# ── PCI DSS: strip debug logging in release builds ───────────────────────────
# Log.d / Log.v calls inside the SDK are safe after the source-level removals,
# but -assumenosideeffects provides defence-in-depth: any Log.d/v call added
# in the future is stripped automatically in every minified release build.
# The Kotlin string interpolation that feeds the call is also dead-code-eliminated.

-assumenosideeffects class android.util.Log {
    public static int d(...);
    public static int v(...);
}
