import 'package:flutter/material.dart';

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

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


class RecipientPaymentRow extends StatelessWidget {
  final Recipient recipient;
  final double spacing;

  const RecipientPaymentRow({
    super.key, 
    required this.recipient, 
    this.spacing = 18
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      spacing: spacing,
      children: [
        if (recipient.bank?.accountNumber.isNotEmpty ?? false)
          RecipientAddressBookInfoRow(
            type: PaymentType.bankAccount, 
            value: recipient.bank!.accountNumber
          ),
        if (recipient.card?.pan.isNotEmpty ?? false)
          RecipientAddressBookInfoRow(
            type: PaymentType.card, 
            value: recipient.card!.pan
          ),
        if (recipient.iban?.iban.isNotEmpty ?? false)
          RecipientAddressBookInfoRow(
            type: PaymentType.iban, 
            value: recipient.iban!.iban
          ),
        if (recipient.wallet?.walletId.isNotEmpty ?? false)
          RecipientAddressBookInfoRow(
            type: PaymentType.wallet, 
            value: recipient.wallet!.walletId
          ),
      ],
    );
  }
}