import 'package:flutter/material.dart';

import 'package:pweb/models/payment/multiple_payouts/csv_row.dart';

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


class FileFormatSampleTable extends StatelessWidget {
  const FileFormatSampleTable({super.key, required this.rows});

  final List<CsvPayoutRow> rows;

  @override
  Widget build(BuildContext context) {
    final l10n = AppLocalizations.of(context)!;
    return DataTable(
      columnSpacing: 20,
      columns: [
        DataColumn(label: Text(l10n.cardNumberColumn)),
        DataColumn(label: Text(l10n.firstName)),
        DataColumn(label: Text(l10n.lastName)),
        DataColumn(label: Text(l10n.expiryDate)),
        DataColumn(label: Text(l10n.amountColumn)),
        DataColumn(label: Text(l10n.commentColumn)),
      ],
      rows: rows.map((row) {
        return DataRow(
          cells: [
            DataCell(Text(row.pan)),
            DataCell(Text(row.firstName)),
            DataCell(Text(row.lastName)),
            DataCell(
              Text('${row.expMonth.toString().padLeft(2, '0')}/${row.expYear}'),
            ),
            DataCell(Text(row.amount)),
            DataCell(Text(row.comment ?? '')),
          ],
        );
      }).toList(),
    );
  }
}
