package com.example.exvesta.Screans

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material.DrawerValue
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController

//noinspection UsingMaterialAndMaterial3Libraries
import androidx.compose.material.*
import androidx.compose.runtime.*

import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Menu
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import kotlinx.coroutines.launch

@Composable
fun Wardrob(navHost: NavHostController) {
    var drawerState = rememberDrawerState(DrawerValue.Closed)
    val scope = rememberCoroutineScope()
    var isFiltersVisible by remember { mutableStateOf(false) }

    ModalDrawer(
        drawerState = drawerState,
        drawerContent = {

        },
    ) {
        Column(
            modifier = Modifier
                .fillMaxSize()
                .background(Color.White)
                .padding(16.dp),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Row(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(vertical = 16.dp),
                verticalAlignment = Alignment.CenterVertically,
                horizontalArrangement = Arrangement.Start
            ) {
                IconButton(onClick = {
                    scope.launch { drawerState.open() }
                }) {
                    Icon(imageVector = Icons.Filled.Menu, contentDescription = "Menu")
                }
            }
            Spacer(modifier = Modifier.height(40.dp))

            Button(
                onClick = {

                    scope.launch { drawerState.close() } // Закрываем drawer
                },
                border = BorderStroke(1.dp, Color(0xFF92A2B0)),
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(vertical = 8.dp),
                colors = ButtonDefaults.buttonColors(Color.White)
            ) {
                Text(text = "+ добавить фильтр", color = Color(0xFF92A2B0))
            }

            Spacer(modifier = Modifier.height(10.dp))
            Button(
                onClick = { /*TODO*/ },
                border = BorderStroke(1.dp, Color(0xFF92A2B0)),
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(vertical = 8.dp),
                colors = ButtonDefaults.buttonColors(Color.White)
            ) {
                Text(text = "+ добавить вещь", color = Color(0xFF92A2B0))
            }


        }
    }
}


//@Composable
//fun DrawerContent() {
//    Column(
//        modifier = Modifier
//            .fillMaxHeight()
//            .width(250.dp)
//            .background(Color(0xFFF0F0F0))
//            .padding(16.dp),
//        verticalArrangement = Arrangement.Top
//    ) {
//        Text(
//            text = "EXVESTA",
//            fontSize = 20.sp,
//            fontWeight = FontWeight.Bold,
//            color = Color.Black
//        )
//        Spacer(modifier = Modifier.height(16.dp))
//        // Аватар пользователя
//        Box(
//            modifier = Modifier
//                .size(100.dp)
//                .clip(CircleShape)
//                .background(Color.LightGray)
//        )
//        Spacer(modifier = Modifier.height(16.dp))
//        Text(
//            text = "user_name",
//            fontSize = 16.sp,
//            fontWeight = FontWeight.Medium,
//            color = Color.Black
//        )
//        Spacer(modifier = Modifier.height(32.dp))
//        // Кнопки
//        Button(
//            onClick = { /* TODO: Открыть "Мои образы" */ },
//            modifier = Modifier
//                .fillMaxWidth()
//                .height(48.dp),
//            colors = ButtonDefaults.buttonColors(
//                Color(0xFFF0F0F0),
//                contentColor = Color.Black
//            )
//        ) {
//            Text("Мои образы")
//        }
//        Spacer(modifier = Modifier.height(8.dp))
//        Button(
//            onClick = { /* TODO: Открыть "Коллекция" */ },
//            modifier = Modifier
//                .fillMaxWidth()
//                .height(48.dp),
//            colors = ButtonDefaults.buttonColors(
//                Color(0xFFF0F0F0),
//                contentColor = Color.Black
//            )
//        ) {
//            Text("Коллекция")
//        }
//    }
//}