class ObaAisConsentMapper {

    public AisAccountAccess accountAccess(AisAccountAccessInfoTO access, List<AccountDetailsTO> accountDetails) {
        // TODO missing relationship to currency here.
        List<AccountReference> accounts = mapToAccountReference(access.getAccounts(), accountDetails);
        List<AccountReference> balances = mapToAccountReference(access.getBalances(), accountDetails);
        List<AccountReference> transactions = mapToAccountReference(access.getTransactions(), accountDetails);
        String availableAccounts = Optional.ofNullable(access.getAvailableAccounts())
                                       .map(Enum::name)
                                       .orElse(null);

        String allPsd2 = Optional.ofNullable(access.getAllPsd2())
                             .map(Enum::name)
                             .orElse(null);

        return new AisAccountAccess(accounts, balances, transactions, availableAccounts, allPsd2, null, null);
    }

}