plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'de.hackernet.wireguardtv'
    compileSdk 34

    defaultConfig {
        applicationId "de.hackernet.wireguardtv"
        minSdk 22  // Fire TV Stick 1st Gen support
        targetSdk 34
        versionCode 1
        versionName "1.0.0"

        vectorDrawables {
            useSupportLibrary true
        }
    }

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

    compileOptions {
        // Core Library Desugaring für Java 8 Time APIs auf älteren Android-Versionen
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    buildFeatures {
        viewBinding true
    }
    lint {
        disable 'MissingLeanbackLauncher'
    }

}

dependencies {
    // Core Library Desugaring - ermöglicht Java 8 Time APIs auf älteren Android-Versionen
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'

    // Android TV / Leanback (für D-Pad Navigation)
    implementation 'androidx.leanback:leanback:1.0.0'
    implementation 'androidx.leanback:leanback-preference:1.1.0-rc01'
    implementation 'androidx.preference:preference-ktx:1.2.1'

    // Core Android
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'

    // Material Design (für einige UI-Elemente)
    implementation 'com.google.android.material:material:1.11.0'

    // WireGuard Tunnel Library
    implementation 'com.wireguard.android:tunnel:1.0.20230706'

    // Gson für Config-Parsing
    implementation 'com.google.code.gson:gson:2.10.1'

    // DataStore für Preferences
    implementation 'androidx.datastore:datastore-preferences:1.0.0'
}
