/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * This file was created using the `create_project.py` script located in the
 * `<AndroidX root>/development/project-creator` directory.
 *
 * Please use that script when creating a new project, rather than copying an existing project and
 * modifying its settings.
 */

import androidx.build.KotlinTarget
import androidx.build.LibraryType
import androidx.build.PlatformIdentifier

plugins {
    id("AndroidXPlugin")
    id("AndroidXComposePlugin")
    id("com.android.library")
}

androidXMultiplatform {
    android()

    defaultPlatform(PlatformIdentifier.ANDROID)

    sourceSets {
        commonMain {
            dependencies {
                api("androidx.lifecycle:lifecycle-viewmodel:2.8.7")
                api("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")

                implementation(libs.kotlinStdlib)
                implementation("androidx.compose.runtime:runtime:1.7.5")
                implementation("androidx.compose.runtime:runtime-saveable:1.7.5")
                implementation(project(":navigation3:navigation3"))
                implementation(project(":savedstate:savedstate"))
                implementation(project(":savedstate:savedstate-compose"))
            }
        }

        commonTest {
            dependencies {
                implementation(libs.kotlinTest)
                implementation(project(":kruth:kruth"))
                implementation(project(":compose:runtime:runtime-test-utils"))
            }
        }

        jvmMain {
            dependsOn(commonMain)
            dependencies {
            }
        }

        androidMain {
            dependsOn(jvmMain)
            dependencies {
                implementation("androidx.activity:activity-compose:1.10.0-beta01")
            }
        }

        jvmTest {
            dependsOn(commonTest)
            dependencies {
            }
        }

        androidInstrumentedTest {
            dependsOn(jvmTest)
            dependencies {
                implementation(libs.testRules)
                implementation(libs.testRunner)
                implementation(libs.junit)
                implementation(libs.testExtJunitKtx)
                implementation(libs.truth)
                implementation(project(":compose:test-utils"))
                implementation("androidx.compose.ui:ui-test:1.7.5")
                implementation("androidx.compose.ui:ui-test-junit4:1.7.5")
            }
        }
    }
}

android {
    compileSdk = 35
    namespace = "androidx.lifecycle.viewmodel.navigation3"
}

androidx {
    name = "Androidx Lifecycle Navigation3 ViewModel"
    type = LibraryType.SNAPSHOT_ONLY_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2024"
    description = "Provides the ViewModel wrapper for nav3."
    doNotDocumentReason = "Not published to maven"
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}
