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

android {
    namespace 'com.streamflix.tv'
    compileSdk 36

    defaultConfig {
        applicationId "com.streamflix.tv"
        minSdk 23
        targetSdk 36
        versionCode 1
        versionName "1.0.0"

        // Backend API URL - StreamFlix server
        buildConfigField "String", "API_BASE_URL", '"https://nf.khoavo.myds.me"'
    }

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

    buildFeatures {
        buildConfig true
        viewBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
}

dependencies {
    // AndroidX Core
    implementation 'androidx.core:core-ktx:1.17.0'
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'androidx.activity:activity-ktx:1.12.2'
    implementation 'androidx.fragment:fragment-ktx:1.8.9'
    
    // Leanback (TV UI Framework)
    implementation 'androidx.leanback:leanback:1.2.0'
    implementation 'androidx.leanback:leanback-preference:1.2.0'
    
    // Lifecycle & ViewModel
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.10.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.10.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.10.0'
    
    // Networking
    implementation 'com.squareup.retrofit2:retrofit:3.0.0'
    implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
    implementation 'com.squareup.okhttp3:okhttp:5.3.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:5.3.2'
    
    // Image Loading
    implementation 'com.github.bumptech.glide:glide:5.0.5'
    kapt 'com.github.bumptech.glide:compiler:5.0.5'
    
    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2'
    
    // ExoPlayer (Video Playback with HLS support)
    implementation 'androidx.media3:media3-exoplayer:1.9.0'
    implementation 'androidx.media3:media3-exoplayer-hls:1.9.0'
    implementation 'androidx.media3:media3-ui:1.9.0'
    implementation 'androidx.media3:media3-ui-leanback:1.9.0'
}
