import 'package:flutter/material.dart';

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

import 'package:pweb/pages/payment_methods/icon.dart';
import 'package:pweb/utils/payment/label.dart';


class PaymentTypeTile extends StatelessWidget {
  final PaymentType type;
  final void Function(PaymentType type) onSelected;

  const PaymentTypeTile({
    super.key,
    required this.type,
    required this.onSelected,
  });

  @override
  Widget build(BuildContext context) {
    final label = getPaymentTypeLabel(context, type);

    return InkWell(
      borderRadius: BorderRadius.circular(8),
      onTap: () => onSelected(type),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 8),
        child: Row(
          children: [
            Icon(iconForPaymentType(type), size: 24),
            const SizedBox(width: 12),
            Text(
              label,
              style: Theme.of(context).textTheme.bodyMedium,
            ),
          ],
        ),
      ),
    );
  }
}
