import 'package:money2/money2.dart';


class PaymentOperationMoneySnapshot {
  final Money? amount;
  final Money? convertedAmount;

  const PaymentOperationMoneySnapshot({
    required this.amount,
    required this.convertedAmount,
  });
}

class PaymentOperationMoney {
  final PaymentOperationMoneySnapshot? planned;
  final PaymentOperationMoneySnapshot? executed;

  const PaymentOperationMoney({required this.planned, required this.executed});
}

class PaymentExecutionOperation {
  final String? stepRef;
  final String? operationRef;
  final String? gateway;
  final String? code;
  final String? state;
  final String? label;
  final PaymentOperationMoney? money;
  final String? failureCode;
  final String? failureReason;
  final DateTime? startedAt;
  final DateTime? completedAt;

  const PaymentExecutionOperation({
    required this.stepRef,
    required this.operationRef,
    required this.gateway,
    required this.code,
    required this.state,
    required this.label,
    required this.money,
    required this.failureCode,
    required this.failureReason,
    required this.startedAt,
    required this.completedAt,
  });

  Money? get amount => money?.executed?.amount ?? money?.planned?.amount;
  Money? get convertedAmount =>
      money?.executed?.convertedAmount ?? money?.planned?.convertedAmount;
  Money? get plannedAmount => money?.planned?.amount;
  Money? get plannedConvertedAmount => money?.planned?.convertedAmount;
  Money? get executedAmount => money?.executed?.amount;
  Money? get executedConvertedAmount => money?.executed?.convertedAmount;
}
