plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'kotlin-kapt'
}

android {
    def ext = rootProject.extensions.ext
    compileSdkVersion ext.android.compileSdk

    defaultConfig {
        minSdkVersion ext.android.minSdk
        targetSdkVersion ext.android.targetSdk
        versionCode ext.application.versionCode
        versionName ext.application.versionName
    }

    buildTypes {
        debug {
            testCoverageEnabled true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

def API_URL = System.getenv("API_URL") ?: apiUrl
def API_KEY = System.getenv("API_KEY") ?: apiKey

android.buildTypes.each { type ->
    type.buildConfigField "String", "API_URL", "\"$API_URL\""
    type.buildConfigField "String", "API_KEY", "\"$API_KEY\""
}

dependencies {
    implementation project(':domain')
    kapt dataKaptDependencies
    implementation dataDependencies
    testImplementation dataTestDependencies
}
