import 'package:flutter/material.dart';

import 'package:pweb/models/invitation/invitation_filter.dart';
import 'package:pweb/pages/invitations/widgets/filter/invitation_filter.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class InvitationFilterChips extends StatelessWidget {
  final InvitationFilter selectedFilter;
  final ValueChanged<InvitationFilter> onSelected;

  const InvitationFilterChips({
    super.key,
    required this.selectedFilter,
    required this.onSelected,
  });

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;
    return Wrap(
      spacing: 8,
      runSpacing: 8,
      children: InvitationFilter.values.map(
        (filter) => ChoiceChip(
          label: Text(invitationFilterLabel(filter, loc)),
          selected: selectedFilter == filter,
          onSelected: (_) => onSelected(filter),
        ),
      ).toList(),
    );
  }
}
