plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
    id 'com.google.devtools.ksp' version '2.0.20-1.0.24'
    id 'kotlin-parcelize'
    id("org.jetbrains.kotlin.plugin.compose") version "2.0.20"
}

android {
    namespace "com.kanyideveloper.joomia"
    compileSdk 34

    defaultConfig {
        applicationId "com.kanyideveloper.joomia"
        minSdk 21
        targetSdk 34
        versionCode 1
        versionName "1.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
    }
    kotlinOptions {
        jvmTarget = '21'
        apiVersion = "1.8"
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }

    applicationVariants.all { variant ->
        kotlin.sourceSets {
            getByName(variant.name) {
                kotlin.srcDir("build/generated/ksp/${variant.name}/kotlin")
            }
        }
    }
}

dependencies {
    // Kotlin extensions
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
    implementation "androidx.room:room-ktx:2.4.2"

    // Testing
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"

    // Compose
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation 'androidx.activity:activity-compose:1.4.0'
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    implementation "androidx.activity:activity-compose:1.9.0-alpha01"
    implementation "androidx.compose.material:material-icons-extended:$compose_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1"
    implementation "androidx.navigation:navigation-compose:2.5.0-rc01"
    implementation "androidx.compose.runtime:runtime-livedata:$compose_version"

    // Material
    implementation "androidx.compose.material:material:$compose_version"

    // Hilt for DI
    implementation "com.google.dagger:hilt-android:2.51.1"
    kapt "com.google.dagger:hilt-compiler:2.51.1"
    kapt 'androidx.hilt:hilt-compiler:1.1.0'
    implementation 'androidx.hilt:hilt-navigation-compose:1.2.0-alpha01'

    // Navigation made easier
    implementation 'io.github.raamcosta.compose-destinations:core:1.5.9-beta'
    ksp 'io.github.raamcosta.compose-destinations:ksp:1.5.9-beta'

    // Coil for loading images
    implementation("io.coil-kt:coil-compose:2.1.0")

    // System UI Controller for Jetpack Compose
    implementation "com.google.accompanist:accompanist-systemuicontroller:0.24.10-beta"

    // Timber for logging
    implementation 'com.jakewharton.timber:timber:5.0.1'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
    implementation "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2"

    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'

    // Preferences DataStore (SharedPreferences like APIs)
    implementation "androidx.datastore:datastore-preferences:1.0.0"

    // Ratingbar
    implementation 'com.github.a914-gowtham:compose-ratingbar:1.2.3'

    // Room
    def room_version = "2.6.1"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'

    implementation 'software.aws.solution:clickstream:0.13.0'
}