import 'package:flutter/material.dart';

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

import 'package:pweb/pages/dashboard/payouts/single/new_recipient/type.dart';


class SinglePayout extends StatelessWidget {
  final void Function(PaymentType type) onGoToPayment;

  static const double _cardPadding = 30.0;
  static const double _dividerPaddingVertical = 12.0;
  static const double _cardBorderRadius = 12.0;
  static const double _dividerThickness = 1.0;

  const SinglePayout({super.key, required this.onGoToPayment});

  @override
  Widget build(BuildContext context) {
    final paymentTypes = PaymentType.values;
    final dividerColor = Theme.of(context).dividerColor;

    return SizedBox(
      width: double.infinity,
      child: Card(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(_cardBorderRadius),
        ),
        elevation: 4,
        color: Theme.of(context).colorScheme.onSecondary,
        child: Padding(
          padding: const EdgeInsets.all(_cardPadding),
          child: Column(
            children: [
              for (int i = 0; i < paymentTypes.length; i++) ...[
                PaymentTypeTile(
                  type: paymentTypes[i],
                  onSelected: onGoToPayment,
                ),
                if (i < paymentTypes.length - 1)
                  Padding(
                    padding: const EdgeInsets.symmetric(vertical: _dividerPaddingVertical),
                    child: Divider(thickness: _dividerThickness, color: dividerColor),
                  ),
              ],
            ],
          ),
        ),
      ),
    );
  }
}
