# ─── kotlinx.serialization ───────────────────────────────────────────────────
# R8 must not strip the generated $$serializer classes / serializer() methods or
# the @Serializable config (ApiConfiguration, ServerTrustPolicy) fails to (de)serialize.
-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.**
-keepclassmembers class kotlinx.serialization.json.** { *; }

# Keep `serializer()` and the synthetic Companion for every @Serializable type.
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
    static <1>$Companion Companion;
}
-if @kotlinx.serialization.Serializable class ** {
    static **$* *;
}
-keepclassmembers class <2>$<3> {
    kotlinx.serialization.KSerializer serializer(...);
}

# Keep this app's serializable models and their generated serializers explicitly.
-keep,includedescriptorclasses class no.svorka.mcms.**$$serializer { *; }
-keepclassmembers class no.svorka.mcms.** {
    *** Companion;
}
-keepclasseswithmembers class no.svorka.mcms.** {
    kotlinx.serialization.KSerializer serializer(...);
}

# ─── OkHttp / Okio ───────────────────────────────────────────────────────────
# OkHttp ships its own consumer rules; silence the optional-dependency warnings.
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**

# ─── Tink / EncryptedSharedPreferences (androidx.security-crypto) ─────────────
# Tink references compile-only Error Prone annotations that aren't on the runtime
# classpath; they're not needed at runtime, so silence the missing-class errors.
-dontwarn com.google.errorprone.annotations.**
