import java.io.FileInputStream
import java.util.Date
import java.text.SimpleDateFormat
import java.util.Properties
import kotlin.apply

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("io.objectbox")
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
val keystorePropertiesFile = file("keystore.properties")
val keystoreProperties = Properties().apply {
    load(FileInputStream(keystorePropertiesFile))
}

android {
    namespace = "com.fun.wave.pranksounds"
    compileSdk = 36
    defaultConfig {
        applicationId = "com.fun.wave.pranksounds"
        minSdk = 24
        targetSdk = 36
        versionCode = 1
        versionName = "1.0"
        setProperty("archivesBaseName", "Fun Prank Sounds_V" + versionName + "(${versionCode})_$timestamp")
        testInstrumentationRunner = "androidx.sounds.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }

    signingConfigs {
        create("release") {
            storeFile = file(keystoreProperties["keystoreFile"] as String)
            storePassword = keystoreProperties["key_store_password"] as String
            keyAlias = keystoreProperties["key_alias"] as String
            keyPassword = keystoreProperties["key_password"] as String
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = true
            signingConfig = signingConfigs.getByName("release")
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    buildFeatures {
        viewBinding = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.3"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
}

dependencies {
implementation("androidx.appcompat:appcompat:1.7.1")
    implementation("com.google.android.material:material:1.13.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.1")
    implementation("androidx.legacy:legacy-support-v4:1.0.0")
    implementation("androidx.recyclerview:recyclerview:1.4.0")
    implementation ("com.github.bumptech.glide:glide:5.0.5")
    implementation ("com.airbnb.android:lottie:6.7.1")
    implementation("androidx.activity:activity:1.12.1")
    implementation("com.airbnb.android:lottie:6.7.1")


}