import 'package:flutter/material.dart';
import '../../accounts/models/account.dart';
import '../../../../../l10n/app_localizations.dart';

class AccountCard extends StatelessWidget {
  final Account account;

  const AccountCard({super.key, required this.account});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      padding: const EdgeInsets.all(20),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12),
        boxShadow: [
          BoxShadow(
            color: Colors.grey.withAlpha((0.1 * 255).toInt()),
            spreadRadius: 1,
            blurRadius: 5,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                account.accountType,
                style: TextStyle(
                  color: Theme.of(context).colorScheme.onPrimary,
                  fontSize: 18,
                  fontWeight: FontWeight.bold,
                ),
              ),
              Icon(
                account.accountType == 'Savings'
                    ? Icons.savings
                    : Icons.account_balance,
                color: Theme.of(context).colorScheme.onPrimary,
              ),
            ],
          ),
          const SizedBox(height: 20),
          Text(
            account.accountNumber,
            style: TextStyle(
                color: Theme.of(context).colorScheme.onPrimary, fontSize: 16),
          ),
          const SizedBox(height: 30),
          Text(
            '${account.currency} ${account.balance.toStringAsFixed(2)}',
            style: TextStyle(
              color: Theme.of(context).colorScheme.onPrimary,
              fontSize: 22,
              fontWeight: FontWeight.bold,
            ),
          ),
          const SizedBox(height: 5),
          Text(
            AppLocalizations.of(context).availableBalance,
            style: TextStyle(
                color: Theme.of(context).colorScheme.onPrimary, fontSize: 16),
          ),
        ],
      ),
    );
  }
}
