package com.example.triphelper.view.RouteScreens

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.example.triphelper.view.navigation.NavigationRoutes
import com.example.triphelper.view.style.ButtonStyleBackSquare
import com.example.triphelper.view.style.StyleMainFone

@Composable
fun ChoiceTour(navController: NavController, iconsRouteIsActivity: MutableState<Boolean>,titleCity:String, viewModel: RouteViewModel = hiltViewModel()) {
    iconsRouteIsActivity.value = true
    val numberTour = remember { mutableStateOf("") }


    LaunchedEffect(key1 = viewModel.navigationTo) {
        viewModel.navigationTo.collect { destination ->
            destination?.let {
                navController.navigate(destination)
            }
        }
    }
    StyleMainFone()
    Column(
        modifier = Modifier.fillMaxWidth().fillMaxHeight(0.95f),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Column(
            verticalArrangement = Arrangement.spacedBy(50.dp)
        ) {
            Row(
                Modifier.fillMaxWidth(0.9f)
            ){
                ButtonStyleBackSquare(
                    title = "Базовый тур",
                    sizeT = 35.sp
                ) {
                    numberTour.value = "1"
                    navController.navigate("${NavigationRoutes.TOURS}/${titleCity}/${numberTour.value}")
                }
            }
            Row(
                Modifier.fillMaxWidth(0.9f)
            ){
                ButtonStyleBackSquare(
                    title = "Стандартный тур",
                    sizeT = 35.sp
                ) {
                    numberTour.value = "2"
                    navController.navigate("${NavigationRoutes.TOURS}/${titleCity}/${numberTour.value}")
                }
            }
            Row(
                Modifier.fillMaxWidth(0.9f)
            ){
                ButtonStyleBackSquare(
                    title = "Профи тур",
                    sizeT = 35.sp
                ) {
                    numberTour.value = "3"
                    navController.navigate("${NavigationRoutes.TOURS}/${titleCity}/${numberTour.value}")
                }
            }
        }
    }
}