package dev.ulfrx.recipe.di

import dev.ulfrx.recipe.navigation.MealPlanEditorSource
import dev.ulfrx.recipe.ui.screens.home.HomeViewModel
import dev.ulfrx.recipe.ui.screens.mealplaneditor.MealPlanEditorViewModel
import dev.ulfrx.recipe.ui.screens.pantry.PantryViewModel
import dev.ulfrx.recipe.ui.screens.planner.PlannerViewModel
import dev.ulfrx.recipe.ui.screens.recipedetail.RecipeDetailViewModel
import dev.ulfrx.recipe.ui.screens.recipedetail.sampleRecipe
import dev.ulfrx.recipe.ui.screens.search.ShellSearchViewModel
import dev.ulfrx.recipe.ui.screens.search.catalog.RecipeCatalogViewModel
import dev.ulfrx.recipe.ui.screens.shopping.ShoppingViewModel
import org.koin.core.module.dsl.viewModel
import org.koin.dsl.module
import org.koin.plugin.module.dsl.viewModel

val shellModule =
    module {
        viewModel<HomeViewModel>()
        viewModel<PlannerViewModel>()
        viewModel<PantryViewModel>()
        viewModel<ShoppingViewModel>()
        viewModel<ShellSearchViewModel>()
        viewModel<RecipeCatalogViewModel>()

        viewModel { (recipeId: String) ->
            RecipeDetailViewModel(recipeId = recipeId)
        }
        viewModel { (source: MealPlanEditorSource) ->
            MealPlanEditorViewModel(
                source = source,
                recipeProvider = ::sampleRecipe,
                // Phase 6 swaps this for the real PlannedMealsRepository lookup.
                plannedMealProvider = { null },
            )
        }
    }
