# ===================================================================
# Daro M SDK Consumer ProGuard Rules
# ===================================================================
# These rules are automatically applied to apps using this SDK.
# App developers can override these rules in their own proguard-rules.pro
# ===================================================================

# -------------------------------------------------------------------
# Daro SDK Public API
# -------------------------------------------------------------------

# Entry Point
-keep public class droom.daro.m.Daro { public *; }

# Consent status enums (public API)
-keep public enum droom.daro.m.consent.** { *; }

# Daro SDK Initializer (ContentProvider)
-keep class droom.daro.m.DaroMInitializer { *; }

# App Open Ad Manager (public API)
-keep public class droom.daro.m.appopen.DaroAppOpenAdManager { public *; }
-keep public class droom.daro.m.appopen.DaroAppOpenAdManager$Builder { public *; }

# SDK Configuration
-keep public class droom.daro.SDKConfig { *; }
-keep public class droom.daro.SDKConfig$Builder { *; }

# ILRD Revenue Plugin (소비자가 구현/사용하는 게이트 인터페이스 + per-instance 바인더)
-keep public interface droom.daro.m.plugin.DaroPlugin { *; }
-keep public interface droom.daro.m.plugin.DaroPaidEventBinder { *; }

# Listeners (all public interfaces)
-keep public interface droom.daro.core.listener.** { *; }

# Ad Units (all public)
-keep public class droom.daro.core.adunit.** { *; }

# Loaders (public API)
-keep public class droom.daro.loader.** {
    public protected *;
}

# Views (public API)
-keep public class droom.daro.view.** {
    public protected *;
}

# Models - Public classes only (excludes internal like AdUnitInfo)
-keep public class droom.daro.core.model.DaroAd { *; }
-keep public class droom.daro.core.model.DaroAd$* { *; }
-keep public class droom.daro.core.model.DaroViewAd { *; }
-keep public class droom.daro.core.model.DaroInterstitialAd { *; }
-keep public class droom.daro.core.model.DaroAppOpenAd { *; }
-keep public class droom.daro.core.model.DaroRewardedAd { *; }
-keep public class droom.daro.core.model.DaroRewardedAd$* { *; }
-keep public class droom.daro.core.model.DaroLightPopupAd { *; }
-keep public class droom.daro.core.model.DaroNativeAd { *; }
-keep public class droom.daro.core.model.DaroAdInfo { *; }
-keep public class droom.daro.core.model.DaroAdLoadError { *; }
-keep public class droom.daro.core.model.DaroAdDisplayFailError { *; }
-keep public class droom.daro.core.model.DaroNativeAdBinder { *; }
-keep public class droom.daro.core.model.DaroNativeAdBinder$* { *; }
-keep public class droom.daro.core.model.DaroBannerSize { *; }
-keep public class droom.daro.core.model.DaroMediationType { *; }
-keep public class droom.daro.core.model.DaroNativeAdChoicePlacement { *; }
-keep public class droom.daro.core.model.DaroLightPopupAdOptions { *; }
-keep public class droom.daro.core.model.nativetemplate.** { *; }

# -------------------------------------------------------------------
# Ad Network SDKs
# -------------------------------------------------------------------

# Pangle (ByteDance)
-keep class com.bytedance.sdk.** { *; }

# Amazon APS
-keep class com.amazon.** { *; }

# IronSource
-keepclassmembers class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}
-keep class com.ironsource.adapters.** { *; }
-dontwarn com.ironsource.**
-dontwarn com.ironsource.adapters.**
-keepclassmembers class com.ironsource.** { public *; }
-keep public class com.ironsource.**
-keep class com.ironsource.adapters.** { *; }

# IronSource - AppLovin integration
-keepclassmembers class com.applovin.sdk.AppLovinSdk { static *; }
-keep public interface com.applovin.sdk.** { *; }
-keep public interface com.applovin.adview.** { *; }
-keep public interface com.applovin.mediation.** { *; }
-keep public interface com.applovin.communicator.** { *; }

# IronSource - AndroidX
-keep class androidx.localbroadcastmanager.content.LocalBroadcastManager { *; }
-keep class androidx.recyclerview.widget.RecyclerView { *; }
-keep class androidx.recyclerview.widget.RecyclerView$OnScrollListener { *; }

# IronSource - Android
-keep class * extends android.app.Activity

# -------------------------------------------------------------------
# Internal Dependencies (Reflection-based)
# -------------------------------------------------------------------

# Room Database - Entity classes for reflection
-keep class droom.daro.core.data.database.*Entity { *; }
-keep class droom.daro.core.data.database.*Database { *; }

# Retrofit
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# kotlinx.serialization (SDK 내부 DTO 직렬화에 사용)
-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.AnnotationsKt
-keepclassmembers class kotlinx.serialization.json.** {
    *** Companion;
}
-keepclasseswithmembers class kotlinx.serialization.json.** {
    kotlinx.serialization.KSerializer serializer(...);
}
# @Serializable 클래스 자체를 보호 (클래스 + 멤버)
-keep @kotlinx.serialization.Serializable class droom.daro.core.data.network.model.** { *; }
# 생성된 serializer 클래스 보호
-keep class droom.daro.core.data.network.model.**$$serializer { *; }
-keepclassmembers class droom.daro.core.data.network.model.** {
    *** Companion;
    *** INSTANCE;
    kotlinx.serialization.KSerializer serializer(...);
}

# Kotlin Coroutines
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

# -------------------------------------------------------------------
# media3 Player (LINE/InMobi 비디오 광고 + SafeDK)
# -------------------------------------------------------------------
# LINE(FiveAd)/InMobi 비디오 광고가 SafeDK 브리지(LINEVideoBridge 등)를 거쳐 호출하는
# media3 Player 인터페이스 메서드를, SDK를 통합한 앱의 R8이 제거/리네임하지 못하도록 보존.
# (SafeDK가 R8 종료 후 release() 호출을 주입 → R8이 미사용으로 보고 Player.release()V 제거
#  → 런타임 NoSuchMethodError. SafeDK는 원래 이름으로 호출하므로 리네임도 막아야 함.)
# media3는 어댑터의 전이 의존성이라 AAR에 묶이지 않고 소비 앱 R8에서 처리되므로 consumer-rules에 둔다.
# 'class' 키워드는 인터페이스도 매칭하므로 common 패키지 전체(Player 포함)를 보존한다.
-keep class androidx.media3.common.** { *; }
