import 'package:flutter/material.dart';
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart';
import 'package:material_symbols_icons/symbols.dart';
import '../../../l10n/app_localizations.dart';

class FundTransferScreen extends StatelessWidget {
  final String creditAccountNo;
  final String remitterName;

  const FundTransferScreen({
    super.key,
    required this.creditAccountNo,
    required this.remitterName,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(AppLocalizations.of(context)
            .fundTransfer
            .replaceFirst(RegExp('\n'), '')),
      ),
      body: ListView(
        children: [
          FundTransferManagementTile(
            icon: Symbols.input_circle,
            label: AppLocalizations.of(context).ownBank,
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => FundTransferBeneficiaryScreen(
                    creditAccountNo: creditAccountNo,
                    remitterName: remitterName,
                    isOwnBank: true,
                  ),
                ),
              );
            },
          ),
          const Divider(height: 1),
          FundTransferManagementTile(
            icon: Symbols.output_circle,
            label: AppLocalizations.of(context).outsideBank,
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => FundTransferBeneficiaryScreen(
                    creditAccountNo: creditAccountNo,
                    remitterName: remitterName,
                    isOwnBank: false,
                  ),
                ),
              );
            },
          ),
          const Divider(height: 1),
        ],
      ),
    );
  }
}

class FundTransferManagementTile extends StatelessWidget {
  final IconData icon;
  final String label;
  final VoidCallback onTap;
  final bool disable;

  const FundTransferManagementTile({
    super.key,
    required this.icon,
    required this.label,
    required this.onTap,
    this.disable = false,
  });

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: Icon(icon),
      title: Text(label),
      trailing: const Icon(Symbols.arrow_right, size: 20),
      onTap: onTap,
      enabled: !disable,
    );
  }
}
