package com.birdsounds.identify.presentation


import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
import androidx.navigation.NavHostController
import com.google.android.horologist.compose.layout.ScreenScaffold

@Composable
fun StartRecordingScreen(
    context: Context,
    appState: AppState,
    navController: NavHostController,
    isPermissionDenied: Boolean,
    onMicClicked: () -> Unit
) {
    ScreenScaffold {
        val controlDashboardUiState = computeControlDashboardUiState(
            appState = appState,
        )
        ControlDashboard(
            controlDashboardUiState = controlDashboardUiState,
            onMicClicked = onMicClicked,
            navController = navController

        )
    }
}

private fun computeControlDashboardUiState(
    appState: AppState,
): ControlDashboardUiState =
    when (appState) {
        AppState.Ready     -> ControlDashboardUiState(
            micState = ControlDashboardButtonUiState(expanded = false, visible = true, enabled = true),
        )
        AppState.Recording -> ControlDashboardUiState(
            micState = ControlDashboardButtonUiState(expanded = true, visible = true, enabled = true),
        )
    }

private class PlaybackStatePreviewProvider : CollectionPreviewParameterProvider<AppState>(
    listOf(
        AppState.Recording,
        AppState.Ready
    )
)
