plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
}

android {
    namespace = "com.example.godeye"
    compileSdk = 29  // Android 10 для максимальной совместимости

    defaultConfig {
        applicationId = "com.example.godeye.legacy"
        minSdk = 24
        targetSdk = 28  // Android 9
        versionCode = 1
        versionName = "1.0-legacy"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    sourceSets {
        getByName("main") {
            manifest.srcFile("src/main/AndroidManifest-legacy.xml")
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    // ТОЛЬКО ViewBinding для legacy версии
    buildFeatures {
        compose = false
        viewBinding = true
    }
}

dependencies {
    // МИНИМАЛЬНЫЕ зависимости для Android 9
    implementation("androidx.core:core-ktx:1.3.2")
    implementation("androidx.appcompat:appcompat:1.2.0")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.2.0")

    // UI компоненты для legacy
    implementation("com.google.android.material:material:1.3.0")
    implementation("androidx.constraintlayout:constraintlayout:2.0.4")
    implementation("androidx.cardview:cardview:1.0.0")
    implementation("androidx.activity:activity-ktx:1.1.0")

    // ViewModel для legacy
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.2.0")

    // Сетевые библиотеки
    implementation("io.socket:socket.io-client:2.1.0")
    implementation("com.google.code.gson:gson:2.8.9")

    // Корутины
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2")

    // Testing
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.3")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
