# Keep all classes in your SDK package
-keep class nashid.verify.sdk.** { *; }
-keepnames class nashid.verify.sdk.** { *; }

# Keep all interfaces in your SDK package
-keep interface nashid.verify.sdk.** { *; }

# Keep annotations
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes EnclosingMethod

# Retrofit rules
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

# OkHttp rules
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**

# Gson rules
-keepattributes Signature
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class com.google.gson.** { *; }
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keep class nashid.verify.sdk.VerifySDKManager$DefaultImpls { *; }
-keep class nashid.verify.sdk.utils.SdkConfig { *; }
-keep class nashid.verify.sdk.ui.theme.AppTheme { *; }

# NFC related rules
-keep class org.jmrtd.** { *; }
-keep class net.sf.scuba.** { *; }
-keep class org.bouncycastle.** { *; }
-keep class org.ejbca.** { *; }

# Keep any native methods
-keepclasseswithmembernames class * {
    native <methods>;
}

# Keep Parcelable classes
-keepclassmembers class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}

# Keep Serializable classes
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

#adding for passport nfc
# Keep all Bouncy Castle provider classes
-keep class org.spongycastle.** { *; }

# Keep VerifySDKManager and its implementation
-keep interface nashid.verify.sdk.VerifySDKManager { *; }
# Keep models and callbacks
-keep interface nashid.verify.sdk.model.AuthCallback { *; }
-keep class nashid.verify.sdk.model.ExtraData { *; }
-keep class nashid.verify.sdk.model.ExtraDataTypeAdapter { *; }
-keep class nashid.verify.sdk.model.DocumentType { *; }
-keep class nashid.verify.sdk.model.ScanDocumentResult { *; }
-keepclassmembers class nashid.verify.sdk.model.ScanDocumentResult$* { *; }
-keep class nashid.verify.sdk.model.DocumentVerification { *; }
-keep class nashid.verify.sdk.model.** { *; }
-keep class nashid.verify.sdk.utils.KoinEnvironment { *; }
# Keep all Activities to prevent them from being stripped or obfuscated
-keep public class * extends androidx.appcompat.app.AppCompatActivity
-keep class nashid.verify.sdk.VerifySDKManager$DefaultImpls { *; }
-keep class nashid.verify.sdk.utils.SdkConfig { *; }
-keep class nashid.verify.sdk.ui.theme.AppTheme { *; }

# Keep the VerificationHandler interface
-keep interface nashid.verify.sdk.utils.helpers.VerificationHandler { *; }

# Keep companion object
-keep class nashid.verify.sdk.VerifySDKManager$Companion { *; }
-keepclassmembers class nashid.verify.sdk.VerifySDKManager { private static volatile nashid.verify.sdk.VerifySDKManager instance; }


# Keep reflection-based access
-keepattributes *Annotation*
-keepattributes Signature

# General ProGuard settings
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-dontusemixedcaseclassnames
-dontpreverify
-allowaccessmodification
-dontwarn **
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*


# Retain classes annotated with @SerializedName for Gson
-keep class com.google.gson.annotations.** { *; }

# Keep all model classes and fields
-keepclassmembers class * {
    @com.google.gson.annotations.SerializedName <fields>;
}

# OkHttp
-dontwarn okhttp3.**
-keep class okhttp3.** { *; }

# OkHttp Logging Interceptor
-dontwarn okhttp3.logging.**
-keep class okhttp3.logging.** { *; }

# Keep Kotlin Serialization classes
-keep class kotlinx.serialization.** { *; }

