plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'com.google.devtools.ksp' version '2.1.0-1.0.29'
    id("org.jetbrains.kotlin.plugin.compose") version "2.0.0"
    id 'com.google.dagger.hilt.android' version '2.41' apply false
    id 'com.google.gms.google-services'
    id 'kotlin-parcelize'
    id 'com.google.firebase.crashlytics'
    id 'org.jetbrains.kotlin.android'
    id 'org.jetbrains.kotlin.plugin.serialization' version '2.1.10'
}

android {
    compileSdk 35
    namespace 'com.yaros.RadioUrl'
    defaultConfig {
        applicationId "com.yaros.RadioUrl"
        minSdk 23
        targetSdk 35
        versionCode 29
        versionName "1.9.9"
        resourceConfigurations += ['en', 'ru', 'uk']
        setProperty('archivesBaseName', 'RadioUrl' + versionName)
        multiDexEnabled true
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    buildTypes {
        debug {
            minifyEnabled false
            shrinkResources false
            crunchPngs false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            applicationIdSuffix = ".debug"
            buildConfigField "String", "BASE_URL", '"https://soundwaveradio.ru/admin_panel/api/api.php"'
            buildConfigField "String", "API_KEY", '"cda11lHY0ZafN2nrti4U5QAKMDhTw7Czm1xoSsyVLduvRegkqE"'
        }

        release {
            minifyEnabled true
            shrinkResources true
            crunchPngs true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [crashlyticsCollectionEnabled: "false"]
            buildConfigField "String", "BASE_URL", '"https://soundwaveradio.ru/admin_panel/api/api.php"'
            buildConfigField "String", "API_KEY", '"cda11lHY0ZafN2nrti4U5QAKMDhTw7Czm1xoSsyVLduvRegkqE"'
        }
    }
    bundle {
        storeArchive {
            enable = true
        }
    }
    buildFeatures {
        buildConfig true
        compose false
        viewBinding true
    }
    composeOptions {
        kotlinCompilerExtensionVersion "1.5.11"
    }
    lint {
        disable 'MobileAdsSdkOutdatedVersion'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib:2.1.10"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1"

    // Compose
    implementation "androidx.compose.ui:ui:1.7.8"
    implementation "androidx.compose.material3:material3:1.3.2"
    implementation "androidx.activity:activity-compose:1.10.1"
    implementation "androidx.compose.ui:ui-tooling-preview:1.7.8"
    implementation "io.coil-kt.coil3:coil-compose:3.1.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7"

    // AndroidX Libraries
    implementation "androidx.core:core-ktx:1.16.0"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.preference:preference-ktx:1.2.1"
    implementation "androidx.appcompat:appcompat:1.7.0"
    implementation "androidx.activity:activity-ktx:1.10.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.7"
    implementation "androidx.lifecycle:lifecycle-process:2.8.7"
    implementation "androidx.navigation:navigation-fragment-ktx:2.8.9"
    implementation "androidx.navigation:navigation-ui-ktx:2.8.9"
    implementation "androidx.palette:palette-ktx:1.0.0"
    implementation "androidx.preference:preference-ktx:1.2.1"
    implementation "androidx.viewpager2:viewpager2:1.1.0"
    implementation "androidx.recyclerview:recyclerview:1.4.0"
    implementation "androidx.media3:media3-ui:1.6.1"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.1'

    // Media3 Exoplayer
    implementation "androidx.media3:media3-exoplayer:1.6.1"
    implementation "androidx.media3:media3-exoplayer-dash:1.6.1"
    implementation "androidx.media3:media3-exoplayer-hls:1.6.1"
    implementation "androidx.media3:media3-exoplayer-smoothstreaming:1.6.1"
    implementation "androidx.media3:media3-datasource-cronet:1.6.1"
    implementation "androidx.media3:media3-datasource-okhttp:1.6.1"
    implementation "androidx.media3:media3-datasource-rtmp:1.6.1"
    implementation "androidx.media3:media3-session:1.6.1"
    implementation "androidx.media3:media3-decoder:1.6.1"
    implementation "androidx.media3:media3-datasource:1.6.1"
    implementation "androidx.media3:media3-common:1.6.1"

    // Room
    implementation "androidx.room:room-common:2.7.0"
    implementation "androidx.room:room-runtime:2.7.0"
    implementation "androidx.room:room-ktx:2.7.0"
    ksp "androidx.room:room-compiler:2.7.0"
    annotationProcessor 'androidx.room:room-compiler:2.7.0'

    // Firebase (включены в APK, но используются только при наличии GMS на устройстве)
    implementation platform("com.google.firebase:firebase-bom:33.12.0")
    implementation "com.google.firebase:firebase-analytics"
    implementation "com.google.firebase:firebase-crashlytics"
    implementation "com.google.firebase:firebase-config"
    implementation "com.google.firebase:firebase-messaging"
    implementation "com.google.firebase:firebase-perf"

    // Google Play Services (для runtime-детекции)
    implementation "com.google.android.gms:play-services-base:18.5.0"

    // Other Libraries
    implementation "com.jakewharton.timber:timber:5.0.1"
    implementation "com.google.android.material:material:1.12.0"
    implementation "com.google.code.gson:gson:2.12.0"
    implementation "com.android.volley:volley:1.2.1"
    implementation "com.google.android.gms:play-services-ads-identifier:18.2.0"
    implementation 'com.yandex.android:mobileads:7.11.0'
    implementation "com.yandex.ads.mediation:mobileads-unityads:4.12.5.3"
    implementation "com.yandex.ads.mediation:mobileads-mytarget:5.22.1.7"
    implementation 'com.yandex.ads.mediation:mobileads-startapp:5.0.2.6'
    implementation 'com.yandex.ads.mediation:mobileads-mintegral:16.8.61.3'
    implementation 'com.yandex.ads.mediation:mobileads-vungle:7.4.2.1'
    implementation 'com.yandex.ads.mediation:mobileads-chartboost:9.3.1.14'
    implementation 'com.sothree.slidinguppanel:library:3.4.0'
    implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.0'
    implementation 'com.google.android.play:core-ktx:1.8.1'
    implementation 'com.github.bumptech.glide:glide:4.16.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
    implementation 'com.github.claucookie.miniequalizer:library:1.0.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
    implementation 'com.squareup.retrofit2:retrofit:2.11.0'
    implementation(platform('com.squareup.okhttp3:okhttp-bom:4.12.0'))
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")
    implementation 'com.facebook.shimmer:shimmer:0.5.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'commons-io:commons-io:2.18.0'
    implementation(platform("ru.rustore.sdk:bom:7.0.0"))
    implementation("ru.rustore.sdk:review")

    // Dagger Hilt
    implementation "com.google.dagger:hilt-android:2.55"
    ksp "com.google.dagger:hilt-compiler:2.55"

    // Work
    implementation "androidx.work:work-runtime-ktx:2.10.0"

    // Splash Screen
    implementation "androidx.core:core-splashscreen:1.0.1"

    // Supabase
    implementation platform('io.github.jan-tennert.supabase:bom:3.0.3')
    implementation 'io.github.jan-tennert.supabase:postgrest-kt'
    implementation 'io.github.jan-tennert.supabase:realtime-kt'
    implementation 'io.ktor:ktor-client-android:3.0.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'
}
