package com.zyzf.coffeepreorder.ui.navigation

import androidx.annotation.StringRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.ui.graphics.vector.ImageVector
import com.zyzf.coffeepreorder.R

enum class Screen(
    val route: String,
    @StringRes val resourceId: Int,
    val icon: ImageVector = Icons.Filled.Favorite,
    val showInBottomBar: Boolean = true
) {
    Login(
        "login", R.string.coffee_login, showInBottomBar = false
    ),
    Register(
        "register", R.string.coffee_register, showInBottomBar = false
    ),
    CoffeeList(
        "coffee-list", R.string.coffee_main_title, Icons.Filled.Menu
    ),
    Profile(
        "profile", R.string.profile_title, Icons.Filled.AccountCircle
    ),
    Cart(
        "cart", R.string.coffee_cart, Icons.Filled.ShoppingCart
    ),
    Order(
        "order", R.string.coffee_order, Icons.Filled.ShoppingCart
    );

    companion object {
        val bottomBarItems = listOf(
            CoffeeList,
            Profile,
            Cart
        )

        fun getItem(route: String): Screen? {
            val findRoute = route.split("/").first()
            return entries.find { value -> value.route.startsWith(findRoute) }
        }
    }
}