package com.birdsounds.identify.presentation

import android.content.Context
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.ui.Modifier
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.Text
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.compose.layout.ScalingLazyColumn
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults
import com.google.android.horologist.compose.layout.ScreenScaffold
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState


@OptIn(ExperimentalHorologistApi::class)
@Composable
fun SpeciesListView(context: Context,
                    ) {
    val text: MutableState<String> = mutableStateOf("text")
//text.toString()
    val species_list_show = mutableStateListOf<MutableState<String>>()
    for (i in 1..10)
    {
        val hi = mutableStateOf("hi")
        species_list_show.add(hi);
    }
    SpeciesList.setSpeciecsShow_list(species_list_show)
    val species_show: SnapshotStateList<MutableState<String>> = remember { species_list_show }

    val columnState =
        rememberResponsiveColumnState(contentPadding = ScalingLazyColumnDefaults.padding(first = ScalingLazyColumnDefaults.ItemType.Text,
            last = ScalingLazyColumnDefaults.ItemType.Chip))

    ScreenScaffold(scrollState = columnState) {
        ScalingLazyColumn(columnState = columnState, modifier = Modifier.fillMaxSize()) {
            items(species_show) { aSpec -> Text(text = aSpec.value)
            } // Dynamically display the chips

        }
    }

}