apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"


android {
    compileSdkVersion 32
    dataBinding {
        enabled = true
    }
    defaultConfig {
        applicationId "com.gavinsappcreations.upcominggames"
        minSdkVersion 23
        targetSdkVersion 32
        versionCode 2
        versionName "1.01"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    implementation 'com.github.MikeOrtiz:TouchImageView:3.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // KTX
    implementation 'androidx.core:core-ktx:1.7.0'

    // Navigation
    implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation"
    implementation "androidx.navigation:navigation-ui-ktx:$version_navigation"

    // ViewModel and LiveData
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

    // Moshi for parsing the JSON format
    implementation "com.squareup.moshi:moshi:$version_moshi"
    implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"

    // Moshi codegen (required or else we get "Failed to find the generated JsonAdapter class for class"
    // when running release version.
    kapt "com.squareup.moshi:moshi-kotlin-codegen:$version_moshi"

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
    implementation "com.squareup.retrofit2:converter-moshi:$version_retrofit"

    // Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_kotlin_coroutines"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_kotlin_coroutines"

    // Material design components
    implementation "com.google.android.material:material:$version_material"

    // Glide
    implementation "com.github.bumptech.glide:glide:$version_glide"

    // RecyclerView
    implementation "androidx.recyclerview:recyclerview:$version_recyclerview"

    // Room database
    implementation "androidx.room:room-runtime:$version_room"
    kapt "androidx.room:room-compiler:$version_room"

    // Guava (for RateLimiter)
    implementation('com.google.guava:guava:31.1-jre')

    // Paging
    implementation "androidx.paging:paging-runtime:$version_paging"

    // WorkManager
    implementation "androidx.work:work-runtime-ktx:$version_work"

    // Gson
    implementation 'com.google.code.gson:gson:2.9.0'
}
