package com.pixelized.headache.ui.navigation.main

import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.snapshots.SnapshotStateList
import dagger.hilt.android.scopes.ActivityRetainedScoped

interface MainDestination

@ActivityRetainedScoped
class MainNavigator(
    startDestination: MainDestination,
) {
    val backStack: SnapshotStateList<Any> = mutableStateListOf(startDestination)

    fun popBackstack() = backStack.removeLastOrNull()

    fun goTo(destination: MainDestination) {
        backStack.add(destination)
    }
}