package com.github.nullptroma.wallenc.ui.navigation

import com.github.nullptroma.wallenc.ui.screens.main.screens.remotes.RemoteVaultsRoute
import com.github.nullptroma.wallenc.ui.screens.main.screens.vault.LocalVaultRoute
import com.github.nullptroma.wallenc.ui.screens.shared.TextEditRoute

private val mainTopLevelRoutePrefixes: Set<String> = setOf(
    LocalVaultRoute::class.qualifiedName!!,
    RemoteVaultsRoute::class.qualifiedName!!,
)

fun isMainTopLevelRoute(route: String?): Boolean {
    if (route == null) return true
    return mainTopLevelRoutePrefixes.any { route.startsWith(it) }
}

fun isTextEditDestination(route: String?): Boolean {
    val qualified = TextEditRoute::class.qualifiedName ?: return false
    return route?.startsWith(qualified) == true
}

fun shouldShowMainFloatingBack(route: String?): Boolean {
    if (route == null) return false
    return !isMainTopLevelRoute(route)
}
