import com.android.build.api.variant.BuildConfigField

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.kotlin.serialization)
    alias(libs.plugins.compose.compiler)
    alias(libs.plugins.devtools.ksp)
    alias(libs.plugins.androidx.room)
}

android {
    namespace = "com.example.ssau_schedule"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.example.ssau_schedule"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    androidComponents {
        onVariants {
            it.buildConfigFields.putAll(mapOf(
                Pair("BASE_URL",
                    BuildConfigField("String",
                        "\"https://lk.ssau.ru/\"", null)),
                Pair("SIGN_IN_URL",
                    BuildConfigField("String",
                        "\"account/login\"", null)),
                Pair("USER_DETAILS_URL",
                    BuildConfigField("String",
                        "\"api/proxy/current-user-details\"", null)),
                Pair("USER_GROUPS_URL",
                    BuildConfigField("String",
                        "\"api/proxy/personal/groups\"", null)),
                Pair("YEARS_URL",
                    BuildConfigField("String",
                        "\"api/proxy/dictionaries?slug=unified_years\"", null)),
                Pair("LESSONS_URL",
                    BuildConfigField("String",
                        "\"/api/proxy/timetable/get-timetable\"", null))
            ))
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        compose = true
        buildConfig = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.1"
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }

    room {
        schemaDirectory("$projectDir/schemas")
    }
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    implementation(libs.androidx.media3.common)
    implementation(libs.androidx.work.runtime.ktx)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)

    implementation(libs.squareup.okhttp)

    implementation(libs.androidx.datastore)

    implementation(libs.kotlinx.serialization.json)

    implementation(libs.androidx.room.runtime)
    annotationProcessor(libs.androidx.room.compiler)
    ksp(libs.androidx.room.compiler)

    implementation(libs.androidx.room.ktx)

    implementation(libs.androidx.glance)
    implementation(libs.androidx.glance.material)
}
