# FoodLens SDK UI ProGuard Rules
# These rules are automatically applied to apps that use this SDK

# Keep all public API classes
-keep class com.doinglab.foodlens.sdk.ui.** { *; }

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

# Keep Kotlin Parcelize generated classes
-keep class com.doinglab.foodlens.sdk.ui.config.** { *; }
-keep class com.doinglab.foodlens.sdk.ui.model.** { *; }

# Data Binding
-keep class com.doinglab.foodlens.sdk.ui.databinding.** { *; }
-keep class com.doinglab.foodlens.sdk.ui.BR { *; }

# ViewModels
-keep class com.doinglab.foodlens.sdk.ui.activity.**.ViewModel { *; }
-keep class com.doinglab.foodlens.sdk.ui.activity.**ViewModel { *; }
-keep class * extends androidx.lifecycle.ViewModel { *; }

# Room Database
-keep class com.doinglab.foodlens.sdk.ui.data.db.** { *; }
-keep class * extends androidx.room.RoomDatabase { *; }
-keep @androidx.room.Entity class * { *; }
-keep @androidx.room.Dao interface * { *; }

# Keep enum classes
-keepclassmembers enum com.doinglab.foodlens.sdk.ui.** {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep Kotlin metadata
-keepattributes *Annotation*, InnerClasses
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepattributes SourceFile, LineNumberTable

# Kotlin serialization
-keepclassmembers class kotlinx.serialization.json.** { *; }
-keepclasseswithmembers class * {
    kotlinx.serialization.KSerializer serializer(...);
}

# Gson (used for SharedPreferences serialization)
-keepattributes Signature
-keep class com.google.gson.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Gson TypeToken (prevents "Missing type parameter" error)
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken

# Keep R8/ProGuard from removing Kotlin reflection
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.reflect.**

# Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule { <init>(...); }
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}

# CameraView
-keep class com.otaliastudios.cameraview.** { *; }
