plugins {
    alias(libs.plugins.androidLibrary)
    alias(libs.plugins.kotlinAndroid)
    //alias(libs.plugins.kotlin.parcelize)
    alias(libs.plugins.room)
    kotlin("kapt")
}

apply {
    from("../app/config_debug.gradle")
}

val appConfig = findProperty("app") as Map<*, *>
val analyticsConfig = findProperty("analytics") as Map<*, *>


android {
    namespace = "com.remax.base"
    compileSdk = appConfig["compileSdk"] as Int

    defaultConfig {
        minSdk = appConfig["minSdk"] as Int
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField("String", "DEFAULT_USER_CHANNEL", "\"${analyticsConfig["defaultUserChannel"]}\"")
    }

    buildTypes {
        debug {
            isMinifyEnabled = false
            isZipAlignEnabled = true
        }

        release {
            isMinifyEnabled = false
            isZipAlignEnabled = true
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
    }
    buildFeatures {
        viewBinding = true
        buildConfig = true
    }
}

room {
    schemaDirectory("$projectDir/schemas")
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.appcompat)
    implementation(libs.material)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.test.ext.junit)
    androidTestImplementation(libs.espresso.core)

    api(libs.utilcodex)
    api(libs.androidx.core.ktx)
    api(libs.androidx.lifecycle.runtime.ktx)
    api(libs.androidx.room.runtime)
    api(libs.androidx.databinding.runtime)
    api(libs.constraintlayout)
    api(libs.material)
    kapt(libs.androidx.room.compiler)
    api(libs.androidx.room.ktx)
    api(libs.androidx.fragment.ktx)
    api(libs.androidx.work.runtime)
    api(libs.kotlinx.coroutines.core)
    api(libs.kotlinx.coroutines.android)

    // Glide图片加载库
    api(libs.glide)
    kapt(libs.glide.compiler)

    // Lottie动画库
    api(libs.lottie)

    api(platform(libs.firebase.bom))
    api(libs.firebase.config)
    api(libs.firebase.analytics)
    api(libs.firebase.crashlytics)

    // Gson for JSON parsing
    api(libs.gson)
}