# Encore SDK Consumer ProGuard Rules
# These rules are bundled into the AAR and applied by the consumer's R8 pass.
# Every public API class uses $* to automatically keep companions, inner classes,
# sealed subclasses, and any nested types.

# ---- Public API ----

-keep class com.encorekit.encore.Encore { *; }
-keep class com.encorekit.encore.Encore$* { *; }
-keep class com.encorekit.encore.core.canonical.user.UserAttributes { *; }
-keep class com.encorekit.encore.core.canonical.error.EncoreError { *; }
-keep class com.encorekit.encore.core.canonical.error.EncoreError$* { *; }
-keep class com.encorekit.encore.core.infrastructure.logging.LogLevel { *; }
-keep class com.encorekit.encore.core.infrastructure.billing.BillingPurchaseResult { *; }
-keep class com.encorekit.encore.presentation.PlacementBuilder { *; }
-keep class com.encorekit.encore.presentation.PlacementBuilder$* { *; }
-keep class com.encorekit.encore.presentation.PlacementsManager { *; }
-keep class com.encorekit.encore.presentation.PlacementsManager$* { *; }
-keep class com.encorekit.encore.features.offers.PresentationResult { *; }
-keep class com.encorekit.encore.features.offers.PresentationResult$* { *; }
-keep class com.encorekit.encore.features.offers.DismissReason { *; }
-keep class com.encorekit.encore.features.offers.DismissReason$* { *; }

# ---- Moshi: generated models (reflection-based @Json fields) ----

-keep class com.encorekit.encore.generated.** { *; }

# ---- Moshi: KSP codegen adapters ----

-keep @com.squareup.moshi.JsonClass class com.encorekit.encore.** { *; }
-keep class com.encorekit.encore.**JsonAdapter { *; }

# ---- Moshi: KotlinJsonAdapterFactory reflection needs ----

-keep class kotlin.Metadata { *; }
-keepclassmembers class com.encorekit.encore.** {
    @com.squareup.moshi.Json <fields>;
}

# ---- Moshi: enum serialization ----

-keepclassmembers enum com.encorekit.encore.** {
    **[] values();
    public static **[] valueOf(java.lang.String);
}

# ---- ErrorDto (internal, but deserialized from API responses) ----

-keep class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse { *; }

# ---- JDK 9+ string concatenation (desugared at runtime) ----

-dontwarn java.lang.invoke.StringConcatFactory

# ---- Compose + Offer Sheet ----

-keep class com.encorekit.encore.presentation.offers.OfferSheetActivity { *; }
-keep class com.encorekit.encore.presentation.offers.OfferSheetActivity$* { *; }

-if class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse
-keepnames class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse
-if class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse
-keep class com.encorekit.encore.core.canonical.dto.ErrorDto_ErrorResponseJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse
-keepclassmembers class com.encorekit.encore.core.canonical.dto.ErrorDto$ErrorResponse {
    public synthetic <init>(java.lang.String,java.lang.String,java.lang.Boolean,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.canonical.user.UserAttributes
-keepnames class com.encorekit.encore.core.canonical.user.UserAttributes
-if class com.encorekit.encore.core.canonical.user.UserAttributes
-keep class com.encorekit.encore.core.canonical.user.UserAttributesJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.canonical.user.UserAttributes
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.canonical.user.UserAttributes
-keepclassmembers class com.encorekit.encore.core.canonical.user.UserAttributes {
    public synthetic <init>(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.Map,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration
-keepnames class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration
-if class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration
-keep class com.encorekit.encore.core.configuration.remote.EntitlementConfigurationJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration
-keepclassmembers class com.encorekit.encore.core.configuration.remote.EntitlementConfiguration {
    public synthetic <init>(com.encorekit.encore.core.configuration.remote.IAPEntitlement,com.encorekit.encore.core.configuration.remote.NativeEntitlement,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration
-keepnames class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration
-if class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration
-keep class com.encorekit.encore.core.configuration.remote.ExperimentConfigurationJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration
-keepclassmembers class com.encorekit.encore.core.configuration.remote.ExperimentConfiguration {
    public synthetic <init>(com.encorekit.encore.core.configuration.remote.NCLExperiment,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.configuration.remote.IAPEntitlement
-keepnames class com.encorekit.encore.core.configuration.remote.IAPEntitlement
-if class com.encorekit.encore.core.configuration.remote.IAPEntitlement
-keep class com.encorekit.encore.core.configuration.remote.IAPEntitlementJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

-if class com.encorekit.encore.core.configuration.remote.NCLExperiment
-keepnames class com.encorekit.encore.core.configuration.remote.NCLExperiment
-if class com.encorekit.encore.core.configuration.remote.NCLExperiment
-keep class com.encorekit.encore.core.configuration.remote.NCLExperimentJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

-if class com.encorekit.encore.core.configuration.remote.NativeEntitlement
-keepnames class com.encorekit.encore.core.configuration.remote.NativeEntitlement
-if class com.encorekit.encore.core.configuration.remote.NativeEntitlement
-keep class com.encorekit.encore.core.configuration.remote.NativeEntitlementJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

-if class com.encorekit.encore.core.configuration.remote.RemoteConfiguration
-keepnames class com.encorekit.encore.core.configuration.remote.RemoteConfiguration
-if class com.encorekit.encore.core.configuration.remote.RemoteConfiguration
-keep class com.encorekit.encore.core.configuration.remote.RemoteConfigurationJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.configuration.remote.RemoteConfiguration
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.configuration.remote.RemoteConfiguration
-keepclassmembers class com.encorekit.encore.core.configuration.remote.RemoteConfiguration {
    public synthetic <init>(com.encorekit.encore.core.configuration.remote.UIConfiguration,com.encorekit.encore.core.configuration.remote.EntitlementConfiguration,com.encorekit.encore.core.configuration.remote.ExperimentConfiguration,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.configuration.remote.UIConfiguration
-keepnames class com.encorekit.encore.core.configuration.remote.UIConfiguration
-if class com.encorekit.encore.core.configuration.remote.UIConfiguration
-keep class com.encorekit.encore.core.configuration.remote.UIConfigurationJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.configuration.remote.UIConfiguration
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.configuration.remote.UIConfiguration
-keepclassmembers class com.encorekit.encore.core.configuration.remote.UIConfiguration {
    public synthetic <init>(java.lang.String,java.lang.String,java.lang.String,com.encorekit.encore.core.configuration.remote.UIValuesConfiguration,int,kotlin.jvm.internal.DefaultConstructorMarker);
}

-if class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration
-keepnames class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration
-if class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration
-keep class com.encorekit.encore.core.configuration.remote.UIValuesConfigurationJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}
-if class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-if class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration
-keepclassmembers class com.encorekit.encore.core.configuration.remote.UIValuesConfiguration {
    public synthetic <init>(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,kotlin.jvm.internal.DefaultConstructorMarker);
}
