/*
 * 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.SoftwareType
import androidx.build.PlatformIdentifier

plugins {
    id("AndroidXPlugin")
    id("AndroidXComposePlugin")
}

androidXMultiplatform {
    androidLibrary {
        compileSdk = 36
        namespace = "androidx.lifecycle.viewmodel.navigation3"
    }

    defaultPlatform(PlatformIdentifier.ANDROID)

    sourceSets {
        commonMain {
            dependencies {
                api("androidx.lifecycle:lifecycle-viewmodel:2.8.7")
                api("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
                api("androidx.compose.runtime:runtime:1.7.5")
                api("androidx.compose.runtime:runtime-saveable:1.7.5")
                api(project(":navigation3:navigation3-runtime"))
                api("androidx.savedstate:savedstate:1.3.0")
                api("androidx.savedstate:savedstate-compose:1.3.0")
                implementation(libs.kotlinStdlib)
                implementation("androidx.collection:collection-ktx:1.4.5")
            }
        }

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

        jvmMain {
            dependsOn(commonMain)
            dependencies {
            }
        }

        androidMain {
            dependsOn(jvmMain)
            dependencies {
                api("androidx.activity:activity-compose:1.12.0-alpha01")
            }
        }

        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(":navigation3:navigation3-ui"))
                implementation(project(":compose:test-utils"))
                implementation("androidx.compose.animation:animation:1.8.0")
                implementation("androidx.compose.ui:ui-test:1.7.5")
                implementation("androidx.compose.ui:ui-test-junit4:1.7.5")
            }
        }
    }
}

androidx {
    name = "Androidx Lifecycle Navigation3 ViewModel"
    type = SoftwareType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2024"
    description = "Provides the ViewModel wrapper for nav3."
}
