import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

class LifecycleConventionPlugin: Plugin<Project> {
    private val lifecycle_version = "2.5.1"

    override fun apply(target: Project) {
        with(target) {
            with(pluginManager) {
                apply("org.jetbrains.kotlin.kapt")
            }

            dependencies {
                add("implementation","androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
                add("implementation","androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version")

//                add("implementation","androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
                add("kapt","androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
//                add("implementation","androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version")

                add("implementation","androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
                add("implementation","androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version")
            }
        }
    }
}

class LifecycleCoreConventionPlugin: Plugin<Project> {
    private val lifecycle_version = "2.5.1"

    override fun apply(target: Project) {
        with(target) {
            with(pluginManager) {
                apply("org.jetbrains.kotlin.kapt")
            }

            dependencies {
                add("implementation","androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version")
                add("kapt","androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
            }
        }
    }
}