plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'kotlin-parcelize'
}
def paperPropertiesFile = rootProject.file("../keys/paper.properties")
def properties = new Properties()
properties.load(new FileInputStream(paperPropertiesFile))

android {
    compileSdk 33

    defaultConfig {
        applicationId "io.ak1.paper"
        minSdk 21
        targetSdk 33
        versionCode 3
        versionName "1.0.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
        javaCompileOptions {
            annotationProcessorOptions {
                arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }

    signingConfigs {
        release {
            def path = properties['STORE_PATH']
            def store_pass = properties['STORE_PASSWORD']
            def key_alias = properties['KEY_ALIAS']
            def key_pass = properties['KEY_PASSWORD']
            storeFile file(path)
            storePassword store_pass
            keyAlias key_alias
            keyPassword key_pass
        }
    }

    buildTypes {
        release {
            resValue "string", "app_name", "Paper"
            resValue "string", "paper_file_provider", "io.ak1.paper.file_provider"
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            resValue "string", "app_name", "Paper Debug"
            resValue "string", "paper_file_provider", "io.ak1.paper.debug.file_provider"
            applicationIdSuffix '.debug'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    sourceSets {
        androidTest.java.srcDirs += "src/test-common/java"
        test.java.srcDirs += "src/test-common/java"
    }
    namespace 'io.ak1.paper'
}

dependencies {
    //Core
    implementation 'androidx.core:core-ktx:1.9.0'

    //Design
    implementation 'androidx.compose.material3:material3:1.1.0-alpha03'

    //Compose
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.activity:activity-compose:1.6.1'


    // Multidex
    implementation 'androidx.multidex:multidex:2.0.1'

    // Image Size Compressor
    implementation 'id.zelory:compressor:3.0.1'

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

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation "androidx.room:room-ktx:$room_version"

    //Koin
    def koin_version = '3.4.0'
    implementation "io.insert-koin:koin-androidx-compose:$koin_version"

    // LifeCycle
    def lifecycle_version = '2.5.1'

    // ViewModel
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

    // LiveData
    implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

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

    //Datastore Preferences
    implementation 'androidx.datastore:datastore-preferences:1.0.0'

    //Navigation
    implementation 'androidx.navigation:navigation-compose:2.5.3'

    // Coil
    implementation 'io.coil-kt:coil-compose:2.2.2'

    // Drawbox
    implementation 'io.ak1:drawbox:1.0.3'

    // Snapper
    implementation 'dev.chrisbanes.snapper:snapper:0.3.0'

    //RangVikalp
    implementation 'io.ak1:rang-vikalp:1.0.0-alpha02'

    // Gson
    implementation 'com.google.code.gson:gson:2.10'

    // Accompanist
    //Jetpack Navigation Compose Material
    implementation 'com.google.accompanist:accompanist-navigation-material:0.28.0'
    //Permissions
    implementation 'com.google.accompanist:accompanist-permissions:0.28.0'

    // Tests
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}