plugins {
    alias(libs.plugins.android.application)
    // NY LINJE: Aktiver Google Services plugin her
    id("com.google.gms.google-services")
}

android {
    namespace = "com.kbs.kbsintranett"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.kbs.kbsintranett"
        minSdk = 28
        targetSdk = 34
        versionCode = 3
        versionName = "1.4"

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

    // NYTT: Dette må til for å kunne bruke BuildConfig.DEBUG i koden
    buildFeatures {
        buildConfig = true
    }

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

dependencies {
    implementation(libs.appcompat)
    implementation(libs.material)
    implementation(libs.activity)
    implementation(libs.constraintlayout)
    testImplementation(libs.junit)
    androidTestImplementation(libs.ext.junit)
    androidTestImplementation(libs.espresso.core)

    // Nettverk og JSON-håndtering
    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:converter-gson:2.9.0")
    implementation("com.google.code.gson:gson:2.10.1")

    // Navigation Component
    val navVersion = "2.8.5"
    implementation("androidx.navigation:navigation-fragment:$navVersion")
    implementation("androidx.navigation:navigation-ui:$navVersion")

    implementation("com.google.android.gms:play-services-auth:20.7.0")
    implementation("com.github.bumptech.glide:glide:4.16.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

    implementation("androidx.work:work-runtime:2.9.0")

    // Swipe Refresh Layout
    implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
    
    // NY LINJE: Firebase BOM (Bill of Materials) styrer versjoner
    implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
    
    // NY LINJE: (Valgfritt, men lurt for statistikk)
    implementation("com.google.firebase:firebase-analytics")
}
