package com.example.todokotlin.ui

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.FilterChip
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.example.todokotlin.TodoFilter

@Composable
fun FilterBar(
    currentFilter: TodoFilter,
    allCount: Int,
    activeCount: Int,
    doneCount: Int,
    onFilterChange: (TodoFilter) -> Unit,
    modifier: Modifier = Modifier
) {
    Row(
        modifier = modifier
            .fillMaxWidth()
            .padding(horizontal = 16.dp, vertical = 8.dp),
        horizontalArrangement = Arrangement.spacedBy(8.dp)
    ) {
        FilterChip(
            selected = currentFilter == TodoFilter.All,
            onClick = { onFilterChange(TodoFilter.All) },
            label = { Text("All ($allCount)") }
        )
        FilterChip(
            selected = currentFilter == TodoFilter.Active,
            onClick = { onFilterChange(TodoFilter.Active) },
            label = { Text("Active ($activeCount)") }
        )
        FilterChip(
            selected = currentFilter == TodoFilter.Done,
            onClick = { onFilterChange(TodoFilter.Done) },
            label = { Text("Done ($doneCount)") }
        )
    }
}
