plugins {
    alias(libs.plugins.android.library)
}

android {
    namespace = "dev.privacyllc.period.core.data"
    compileSdk = 37

    defaultConfig {
        minSdk = 26
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

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

    testOptions {
        unitTests.isIncludeAndroidResources = true
    }
}

dependencies {
    // Room is an `implementation` dependency on purpose: it must NOT leak onto
    // the compile classpath of anything above this module. That is half of what
    // makes "no module above the repository imports Room" true rather than
    // merely intended — the other half is the guard in issue #7.
    implementation(project(":core:database"))
    // Needed only to name RoomDatabase, PeriodDatabase's supertype, and to build
    // the instance in CycleData. `implementation`, so it stops here.
    implementation(libs.androidx.room.runtime)
    api(project(":domain:cycle"))
    api(project(":domain:prediction"))
    implementation(libs.kotlinx.coroutines.core)

    testImplementation(project(":core:database"))
    testImplementation(libs.junit)
    testImplementation(libs.kotlinx.coroutines.test)
    testImplementation(libs.androidx.room.runtime)
    testImplementation(libs.robolectric)
    testImplementation(libs.androidx.test.core)

    androidTestImplementation(project(":core:database"))
    androidTestImplementation(libs.androidx.test.junit)
    androidTestImplementation(libs.androidx.test.runner)
    androidTestImplementation(libs.androidx.room.runtime)
    androidTestImplementation(libs.kotlinx.coroutines.test)
}
