package com.example.myapplication.ui.navigation

import androidx.annotation.StringRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.ui.graphics.vector.ImageVector
import com.example.myapplication.R

enum class Screen(
    val route: String,
    @StringRes val resourceId: Int,
    val icon: ImageVector = Icons.Filled.Favorite,
    val showInBottomBar: Boolean = true
) {
    Report(
        "report", R.string.report
    ),
    BikeList(
        "Bike-list", R.string.Bike_main_title, Icons.Filled.Home
    ),
    LoginScreen(
        "Login-screen", R.string.Profile_title, Icons.Filled.Home
    ),
    BikeEdit(
        "Bike-edit/{id}", R.string.Bike_view_title, showInBottomBar = false
    ),
    ItemEdit(
        "Item-edit/{id}/{bikeId}", R.string.Item_view_title, showInBottomBar = false
    ),
    BikeView(
        "Bike-view/{id}", R.string.Bike_view_title, showInBottomBar = false
    ),
    ItemList(
        "Item-list", R.string.Items_title, showInBottomBar = false
    ),
    Cart(
        "cart", R.string.Cart_title, Icons.Filled.ShoppingCart
    ),
    RentList(
        "Rent-list", R.string.Rent_title, Icons.Filled.List
    ),
    RentView(
        "Rent-view/{id}", R.string.Rent_view_title, showInBottomBar = false
    ),
    UserProfile(
        "User-profile", R.string.Profile_title, showInBottomBar = false
    );

    companion object {
        val bottomBarItems = listOf(
            BikeList,
            Cart,
            RentList
        )

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