import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pweb/models/wallet.dart';
import 'package:pweb/pages/dashboard/buttons/balance/add_funds.dart';
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
import 'package:pweb/pages/dashboard/buttons/balance/config.dart';
import 'package:pweb/pages/dashboard/buttons/balance/header.dart';
import 'package:pweb/providers/wallets.dart';


class WalletCard extends StatelessWidget {
  final Wallet wallet;

  const WalletCard({
    super.key,
    required this.wallet,
  });

  @override
  Widget build(BuildContext context) {
    return Card(
      color: Theme.of(context).colorScheme.onSecondary,
      elevation: WalletCardConfig.elevation,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(WalletCardConfig.borderRadius),
      ),
      child: Padding(
        padding: WalletCardConfig.contentPadding,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            BalanceHeader(
              walletName: wallet.name,
              walletId: wallet.walletUserID,
            ),
            BalanceAmount(
              wallet: wallet,
              onToggleVisibility: () {
                context.read<WalletsProvider>().toggleVisibility(wallet.id);
              },
            ),
            BalanceAddFunds(
              onTopUp: () {
                // TODO: Implement top-up functionality
              },
            ),
          ],
        ),
      ),
    );
  }
}