plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.devtools.ksp' version '1.9.23-1.0.20'
    id 'dagger.hilt.android.plugin'
}

android {
    namespace 'com.opennotes'
    compileSdk 35

    defaultConfig {
        applicationId "com.opennotes"
        minSdk 24
        targetSdk 35
        versionCode 5
        versionName "1.3.1"

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

    dependenciesInfo {
        includeInApk false
        includeInBundle false
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion '1.5.13'
    }

    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
            excludes += 'META-INF/*'
        }
    }
}

dependencies {
    // Compose BOM
    implementation platform('androidx.compose:compose-bom:2024.04.00')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.material:material'
    implementation 'androidx.compose.material:material-icons-extended'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.datastore:datastore-core-android:1.1.7'
    implementation 'androidx.datastore:datastore-preferences:1.1.1'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    androidTestImplementation platform('androidx.compose:compose-bom:2024.04.00')
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'

    implementation 'androidx.activity:activity-compose:1.8.2'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2'
    implementation 'androidx.navigation:navigation-compose:2.7.7'
    implementation 'androidx.hilt:hilt-navigation-compose:1.1.0'

    // Material 3
    implementation 'androidx.compose.material3:material3:1.2.1'

    // Core Android
    implementation 'androidx.core:core-ktx:1.13.1'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'

    // Hilt with KSP
    implementation 'com.google.dagger:hilt-android:2.48'
    ksp 'com.google.dagger:hilt-android-compiler:2.48'
    ksp 'androidx.hilt:hilt-compiler:1.1.0'

    // Room with KSP - Compatible with Kotlin 1.9.23
    implementation 'androidx.room:room-runtime:2.6.1'
    implementation 'androidx.room:room-ktx:2.6.1'
    ksp 'androidx.room:room-compiler:2.6.1'

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

    implementation 'com.google.code.gson:gson:2.10.1'

    implementation 'androidx.core:core-splashscreen:1.0.1'

    // Testing
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}