package com.aiosman.ravenow.ui.search

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier

@Composable
fun SearchScreen() {
    Scaffold { paddingValues ->
        var tabIndex by remember { mutableStateOf(0) }
        Column(
            modifier = Modifier
                .fillMaxWidth()
                .padding(paddingValues)
        ) {
            TextField(
                value = "",
                onValueChange = {},
                label = { Text("Search") },
                modifier = Modifier.fillMaxWidth(),
                trailingIcon = {
                    Icon(
                        imageVector = Icons.Default.Search,
                        contentDescription = null
                    )
                }
            )
            TabRow(selectedTabIndex = tabIndex) {
                Tab(text = { Text("Post") },
                    selected = tabIndex == 0,
                    onClick = { tabIndex = 0 }
                )
                Tab(text = { Text("User") },
                    selected = tabIndex == 1,
                    onClick = { tabIndex = 1 }
                )
            }
            when (tabIndex) {
                0 -> SearchPostResults()
                1 -> SearchUserResults()
            }
        }
    }
}

@Composable
fun SearchPostResults() {
    Text("Post Results")
}
@Composable
fun SearchUserResults(){
    Text("User Results")
}