ext.publishName = "Microsoft Azure Android Client Library Chat SDK For Communication Service"
description = "This package contains the Android client library Chat SDK for Microsoft Azure Communication Service."
ext.versionCode = 1

android {
    defaultConfig {
        minSdkVersion 23
        versionCode project.versionCode
        versionName project.version

        def buildVariant = getBuildVariant()
        def envPropertiesFile
        if ((buildVariant == "Prod")) {
            envPropertiesFile = "env-prod.properties"
        } else if ((buildVariant == "Test")) {
            envPropertiesFile = "env-test.properties"
        } else {
            envPropertiesFile = "env-prod.properties"
        }

        def envProperties = new Properties()
        envProperties.load(new FileInputStream("$projectDir/" + envPropertiesFile))
        println("buildVariant = $buildVariant")
        for (String key : envProperties.keySet()) {
            buildConfigField "String", key.replaceAll("\\.", "_").toUpperCase(), envProperties[key]
        }
    }
}

static def getBuildVariant() {
    return "Prod"
}

dependencies {
    // <!-- begin: api Dependencies -->
    api "com.azure.android:azure-core:$azureCoreVersion"
    api "com.azure.android:azure-core-credential:$azureCoreVersion"
    api "com.azure.android:azure-core-http:$azureCoreVersion"
    api "com.azure.android:azure-core-logging:$azureCoreVersion"
    api "com.azure.android:azure-core-rest:$azureCoreVersion"

    api "net.sourceforge.streamsupport:android-retrofuture:$retroFutureVersion"

    api "com.azure.android:azure-communication-common:$azureCommunicationCommonVersion"
    // <!-- end: api Dependencies -->

    // <!-- begin: implementation Dependencies -->
    implementation "com.azure.android:azure-core-http-okhttp:$azureCoreVersion"
    implementation "com.microsoft:trouter-client-android:$trouterVersion"
    // <!-- end: implementation Dependencies -->

    // <!-- begin: test Dependencies -->
    testImplementation "com.azure.android:azure-core-test:$azureCoreVersion"
    testImplementation "com.nimbusds:nimbus-jose-jwt:$nimbusJoseJwtTestVersion"
    testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
    testImplementation "org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion"
    testImplementation "org.mockito:mockito-core:$mockitoVersion"

    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
    // <!-- end: test Dependencies -->
    def work_version = "2.7.1"
    // (Java only)
    implementation "androidx.work:work-runtime:$work_version"

}
