import 'package:flutter/material.dart';

import 'package:pweb/models/payment/amount/mode.dart';
import 'package:pweb/pages/dashboard/payouts/amount/mode/button.dart';

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


class PaymentAmountModeSelector extends StatelessWidget {
  final PaymentAmountMode selectedMode;
  final ValueChanged<PaymentAmountMode> onModeChanged;

  const PaymentAmountModeSelector({
    super.key,
    required this.selectedMode,
    required this.onModeChanged,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final loc = AppLocalizations.of(context)!;
    return Container(
      padding: const EdgeInsets.all(2),
      decoration: BoxDecoration(
        color: theme.colorScheme.onSecondary,
        borderRadius: BorderRadius.circular(10),
        border: Border.all(
          color: theme.colorScheme.outline,
        ),
      ),
      child: Row(
        children: [
          Expanded(
            child: ModeButton(
              label: loc.debitAmountLabel,
              isSelected: selectedMode == PaymentAmountMode.debit,
              onTap: () => onModeChanged(PaymentAmountMode.debit),
            ),
          ),
          const SizedBox(width: 2),
          Expanded(
            child: ModeButton(
              label: loc.expectedSettlementAmountLabel,
              isSelected: selectedMode == PaymentAmountMode.settlement,
              onTap: () => onModeChanged(PaymentAmountMode.settlement),
            ),
          ),
        ],
      ),
    );
  }
}