package me.teridax.jcash.gui.login; import me.teridax.jcash.banking.BankingManagementSystem; import me.teridax.jcash.banking.Profile; import java.util.Optional; public class LoginData { private final BankingManagementSystem bms; public LoginData(BankingManagementSystem bms) { this.bms = bms; } public Optional authenticateAccount(String blz, int iban, int pin) { var optionalBank = bms.getBank(blz); if (optionalBank.isEmpty()) return Optional.empty(); var profile = optionalBank.get().getAccount(iban); return profile.filter(value -> value.getPrimaryAccount().getPin() == pin); } }