import 'package:flutter/material.dart';

import 'package:pshared/models/payment/execution_operation.dart';
import 'package:pshared/models/payment/payment.dart';

import 'package:pweb/pages/report/details/header.dart';
import 'package:pweb/pages/report/details/sections.dart';
import 'package:pweb/pages/report/details/summary_card/widget.dart';

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


class PaymentDetailsContent extends StatelessWidget {
  final Payment payment;
  final VoidCallback onBack;
  final bool Function(PaymentExecutionOperation operation)?
  canDownloadOperationDocument;
  final ValueChanged<PaymentExecutionOperation>? onDownloadOperationDocument;

  const PaymentDetailsContent({
    super.key,
    required this.payment,
    required this.onBack,
    this.canDownloadOperationDocument,
    this.onDownloadOperationDocument,
  });

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;

    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          PaymentDetailsHeader(title: loc.paymentInfo, onBack: onBack),
          const SizedBox(height: 16),
          PaymentSummaryCard(payment: payment),
          const SizedBox(height: 16),
          PaymentDetailsSections(
            payment: payment,
            canDownloadOperationDocument: canDownloadOperationDocument,
            onDownloadOperationDocument: onDownloadOperationDocument,
          ),
        ],
      ),
    );
  }
}
