package dev.banking.service;

import dev.banking.model.*;
import dev.banking.processor.TransactionProcessor;
import java.util.List;
import java.util.concurrent.ExecutorService;

public class BankingSystem {

    private final ExecutorService executor;
    private final TransactionProcessor processor;

    public BankingSystem(
            ExecutorService executor,
            TransactionProcessor processor
    ) {
        this.executor = executor;
        this.processor = processor;
    }

    public void processTransactions(
            List<Transaction> transactions
    ) {
        for (Transaction tx : transactions) {
            executor.submit(() -> {
                processor.process(tx);
            });
        }
    }
}