class CmsPsuAisServiceInternal implements CmsPsuAisService {

    @Override
    public Optional<List<CmsAisPsuDataAuthorisation>> getPsuDataAuthorisations(@NotNull String consentId, @NotNull String instanceId) {
        Optional<ConsentEntity> aisConsentOptional = getActualAisConsent(consentId, instanceId);

        if (aisConsentOptional.isEmpty()) {
            return Optional.empty();
        }

        List<AuthorisationEntity> consentAuthorisations = authorisationRepository.findAllByParentExternalIdAndType(aisConsentOptional.get().getExternalId(),
                                                                                                                   AuthorisationType.CONSENT);
        return Optional.of(getPsuDataAuthorisations(consentAuthorisations));
    }

}