# frozen_string_literal: true

require "value_semantics/monkey_patched"
require_relative "customer_financials"
require_relative "payment_methods"

class AdminFinancialInfo
	value_semantics do
		transactions ArrayOf(CustomerFinancials::TransactionInfo)
		declines Integer
		btc_addresses ArrayOf(String)
		payment_methods PaymentMethods
	end

	def self.for(customer)
		EMPromise.all([
			customer.transactions, customer.declines,
			customer.payment_methods, customer.btc_addresses
		]).then do |transactions, declines, payment_methods, btc_addresses|
			new(
				transactions: transactions,
				declines: declines,
				payment_methods: payment_methods, btc_addresses: btc_addresses
			)
		end
	end
end
