# By default, the flags in this file are appended to flags specified
# in ../sdk/tools/proguard/proguard-android.txt,
# contents of this file will be appended into proguard-android.txt
-keepattributes Signature, *Annotation*, EnclosingMethod

# Reflection on classes from native code
-keep class com.google.gson.JsonArray { *; }
-keep class com.google.gson.JsonElement { *; }
-keep class com.google.gson.JsonObject { *; }
-keep class com.google.gson.JsonPrimitive { *; }
-dontnote com.google.gson.**
-keep enum ai.nextbillion.maps.tile.TileOperation
-keep class ai.nextbillion.maps.core.RenderingStats { *; }
-keep class ai.nextbillion.maps.core.NativeMapOptions { *; }

-keepclassmembers class * extends java.lang.Enum {
    <fields>;
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# dontnote for keeps the entry point x but not the descriptor class y
-dontnote ai.nextbillion.maps.core.NextbillionMap$OnFpsChangedListener
-dontnote ai.nextbillion.maps.style.layers.PropertyValue
-dontnote ai.nextbillion.maps.core.NextbillionMap
-dontnote ai.nextbillion.maps.core.NextbillionMapOptions
-dontnote ai.nextbillion.maps.log.LoggerDefinition

# config for nbmap-sdk-geojson:3.0.1
-keep class ai.nextbillion.maps.geojson.** { *; }
-keep class ai.nextbillion.geojson.** { *; }
-dontwarn com.google.auto.value.**

# config for additional notes
-dontnote org.robolectric.Robolectric
-dontnote libcore.io.Memory
-dontnote com.google.protobuf.**
-dontnote android.net.**
-dontnote org.apache.http.**

# Keep LocationEngineProvider for navigation SDK
-keep class ai.nextbillion.maps.location.engine.** { *; }
-dontnote ai.nextbillion.maps.location.engine.LocationEngine
-dontnote ai.nextbillion.maps.location.engine.LocationEngineProvider


# Keep Google Play Services location classes (optional dependency)
-keep class com.google.android.gms.location.** { *; }
-keep class com.google.android.gms.common.GoogleApiAvailability { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-dontwarn com.google.android.gms.location.**
-dontwarn com.google.android.gms.common.**
# config for nbmap-sdk-services
# while we don't include this dependency directly
# a large amount of users combine it with our SDK
# we aren't able to provide a proguard config in that project (jar vs aar)
-dontwarn com.sun.xml.internal.ws.spi.db.*

# Keep Gestures SDK classes and resources
-keep class ai.nextbillion.gestures.** { *; }
-keep class ai.nextbillion.gestures.R { *; }
-keep class ai.nextbillion.gestures.R$* { *; }
-keepclassmembers class ai.nextbillion.gestures.R$* { *; }
-dontwarn ai.nextbillion.gestures.R$dimen
-dontwarn ai.nextbillion.gestures.R$*

-keep class ai.nextbillion.kits.geojson.** { *; }
-dontwarn com.google.auto.value.**

# Keep Nextbillion class and all its methods (no obfuscation)
-keep class ai.nextbillion.maps.Nextbillion {
    *;
}
-keepclassmembers class ai.nextbillion.maps.Nextbillion {
    *;
}

# Keep public API classes that are referenced by navigation SDK
-keep public class ai.nextbillion.maps.core.MapView {
    public *;
}
-keep public class ai.nextbillion.maps.core.NextbillionMap {
    public *;
}
-keep public class ai.nextbillion.maps.core.Style {
    public *;
}
-keep public class ai.nextbillion.maps.core.Projection {
    public *;
}

# Keep public interfaces and callbacks
-keep public interface ai.nextbillion.maps.core.OnMapReadyCallback { *; }
-keep public interface ai.nextbillion.maps.core.MapView$OnDidFinishLoadingStyleListener { *; }
-keep public interface ai.nextbillion.maps.core.NextbillionMap$OnMapClickListener { *; }
-keep public interface ai.nextbillion.maps.core.NextbillionMap$OnMoveListener { *; }
-keep public interface ai.nextbillion.maps.core.NextbillionMap$CancelableCallback { *; }
-keep public interface ai.nextbillion.maps.core.NextbillionMap$SnapshotReadyCallback { *; }
-keep public interface ai.nextbillion.maps.core.Style$OnStyleLoaded { *; }

# Keep Style.Builder for dynamic style loading
-keep public class ai.nextbillion.maps.core.Style$Builder {
    public *;
}

# Keep location related classes for navigation SDK
-keep public class ai.nextbillion.maps.location.** {
    public *;
}
-keep public interface ai.nextbillion.maps.location.** { *; }

# Ignore optional dependencies warnings
-dontwarn io.grpc.**
-dontwarn io.opentelemetry.api.incubator.**
-dontwarn com.ryanharter.auto.value.gson.**
-dontwarn org.osgi.annotation.**

# config for additional notes
-dontnote org.robolectric.Robolectric
-dontnote libcore.io.Memory
-dontnote com.google.protobuf.**
-dontnote android.net.**
-dontnote org.apache.http.**

# config for mapbox-sdk-services
# while we don't include this dependency directly
# a large amount of users combine it with our SDK
# we aren't able to provide a proguard config in that project (jar vs aar)
-dontwarn com.sun.xml.internal.ws.spi.db.*