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

android {
    namespace = "com.hipograf.companion"
    compileSdk = 36

    defaultConfig {
        applicationId = "com.hipograf.companion"
        minSdk = 28 // Samsung Health SDK requires API 28+
        targetSdk = 35
        versionCode = 1
        versionName = "1.0.0"

        // Backend URL — 10.0.2.2 is the host machine from Android emulator
        // For a real device on the same network, use your machine's LAN IP
        buildConfigField("String", "API_BASE_URL",
            "\"${project.findProperty("HIPOGRAF_API_URL") ?: "http://10.0.2.2:5000"}\"")
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }

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

    kotlinOptions {
        jvmTarget = "17"
    }
}

dependencies {
    // AndroidX
    implementation("androidx.core:core-ktx:1.15.0")
    implementation("androidx.appcompat:appcompat:1.7.0")
    implementation("com.google.android.material:material:1.12.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.1")
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")

    // WorkManager for periodic background sync
    implementation("androidx.work:work-runtime-ktx:2.10.0")

    // Networking
    implementation("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.google.code.gson:gson:2.11.0")

    // Health Connect — reads Samsung Health data via Android's unified health API
    implementation("androidx.health.connect:connect-client:1.1.0-rc03")

    // Activity result API for permission requests
    implementation("androidx.activity:activity-ktx:1.9.3")
}
