plugins {
    id("com.android.library")
    id("org.jetbrains.kotlin.android")
    id("com.google.devtools.ksp")
}

android {
    namespace = "com.isidroid.ui.maps"
    compileSdk = BuildVersions.COMPILE_SDK

    defaultConfig {
        minSdk = BuildVersions.MIN_SDK

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
//        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    buildFeatures {
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = BuildVersions.KOTLIN_COMPILER_EXT_VERSION
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }

    flavorDimensionList.add("distributor")
    productFlavors {
        create("google") {
            dimension = "distributor"
        }

        create("huawei") {
            dimension = "distributor"
        }
    }
}

val googleImplementation by configurations
val huaweiImplementation by configurations

dependencies {
    api(project((":ui:compose_components")))


    api("androidx.core:core-ktx:${GoogleVersions.coreKtx}")
    api("androidx.appcompat:appcompat:${GoogleVersions.appCompat}")

    // compose
    api(platform("androidx.compose:compose-bom:${GoogleVersions.composeBom}"))
    api("androidx.compose.ui:ui")
    api("androidx.compose.ui:ui-graphics")
    api("androidx.compose.ui:ui-tooling-preview")
    api("androidx.compose.material3:material3")
    api("androidx.constraintlayout:constraintlayout-compose:${GoogleVersions.constraint}")

    // tools
    api("com.jakewharton.timber:timber:${ToolsVersions.timber}")
    api("com.airbnb.android:lottie-compose:${ToolsVersions.lottie}")


    googleImplementation("com.google.maps.android:maps-compose:${GoogleVersions.maps}")
    googleImplementation("com.google.maps.android:android-maps-utils:${GoogleVersions.mapUtils}")
    googleImplementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.3")
    googleImplementation("com.google.maps.android:maps-compose-utils:2.11.4")
    googleImplementation("com.google.maps.android:maps-compose-widgets:2.11.4")

    // testing
    testImplementation("junit:junit:${TestVersions.junit}")
    androidTestImplementation("androidx.test.ext:junit:${TestVersions.junitExt}")
    androidTestImplementation("androidx.test.espresso:espresso-core:${TestVersions.espressoCore}")
    androidTestImplementation(platform("androidx.compose:compose-bom:${GoogleVersions.composeBom}"))
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
}