import 'package:flutter/material.dart';

import 'package:pshared/models/recipient/recipient.dart';

import 'package:pweb/pages/address_book/page/recipient/item.dart';


class RecipientAddressBookList extends StatelessWidget {
  final List<Recipient> filteredRecipients;
  final ValueChanged<Recipient>? onSelected;
  final ValueChanged<Recipient>? onEdit;
  final ValueChanged<Recipient>? onDelete;

  const RecipientAddressBookList({
    super.key,
    required this.filteredRecipients,
    this.onSelected,
    this.onEdit,
    this.onDelete,
  });

  @override
Widget build(BuildContext context) {
  return ListView.builder(
    itemCount: filteredRecipients.length,
    itemBuilder: (context, index) {
      final recipient = filteredRecipients[index];
      return Padding(
        padding: const EdgeInsets.symmetric(vertical: 6.0), 
        child: RecipientAddressBookItem(
          recipient: recipient,
          onTap: () => onSelected?.call(recipient),
          onEdit: () => onEdit?.call(recipient),
          onDelete: () => onDelete?.call(recipient),
        ),
      );
    },
  );
}
}
