import 'package:flutter/material.dart';
import 'package:agenda_tasks/l10n/app_localizations.dart';

import '../viewmodels/daily_tasks_viewmodel.dart';

class FilterChips extends StatelessWidget {
  final TaskFilter currentFilter;
  final ValueChanged<TaskFilter> onFilterChanged;

  const FilterChips({
    super.key,
    required this.currentFilter,
    required this.onFilterChanged,
  });

  @override
  Widget build(BuildContext context) {
    final l10n = AppLocalizations.of(context)!;

    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
      child: Row(
        children: [
          FilterChip(
            label: Text(l10n.filterAll),
            selected: currentFilter == TaskFilter.all,
            onSelected: (_) => onFilterChanged(TaskFilter.all),
            materialTapTargetSize: MaterialTapTargetSize.padded,
          ),
          const SizedBox(width: 8),
          FilterChip(
            label: Text(l10n.filterActive),
            selected: currentFilter == TaskFilter.active,
            onSelected: (_) => onFilterChanged(TaskFilter.active),
            materialTapTargetSize: MaterialTapTargetSize.padded,
          ),
          const SizedBox(width: 8),
          FilterChip(
            label: Text(l10n.filterCompleted),
            selected: currentFilter == TaskFilter.completed,
            onSelected: (_) => onFilterChanged(TaskFilter.completed),
            materialTapTargetSize: MaterialTapTargetSize.padded,
          ),
        ],
      ),
    );
  }
}
