package com.isidroid.c23.ui.navigation.destinations

import androidx.compose.runtime.Composable
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavHostController
import com.isidroid.c23.ui.screen.print_jobs.PrintJobsContract
import com.isidroid.c23.ui.screen.print_jobs.PrintJobsScreen
import com.isidroid.c23.ui.screen.print_jobs.PrintJobsViewModel

@Composable
fun PrintJobsScreenDestination(navController: NavHostController) {
    val viewModel: PrintJobsViewModel = hiltViewModel()

    PrintJobsScreen(
        state = viewModel.viewState,
        effectFlow = viewModel.effect,
        onEventSent = { event -> viewModel.setEvent(event) },
        onNavigationRequested = { effect ->
            when (effect) {
                PrintJobsContract.Effect.Navigation.ToBack -> navController.popBackStack()
            }
        },
    )
}