class CountryAuthnRequestGeneratorService {

    public SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto) {
        URI ssoUri = idaAuthnRequestFromHubDto.getoverriddenSsoUrl() != null ? idaAuthnRequestFromHubDto.getoverriddenSsoUrl() :
                countrySingleSignOnServiceHelper.getSingleSignOn(idaAuthnRequestFromHubDto.getIdpEntityId());

        EidasAuthnRequestFromHub eidasAuthnRequestFromHub = eidasAuthnRequestTranslator.getEidasAuthnRequestFromHub(idaAuthnRequestFromHubDto, ssoUri, hubEidasEntityId);

        String request = eidasRequestStringTransformer.apply(eidasAuthnRequestFromHub);
        return new SamlRequestDto(request, ssoUri);
    }

    @Inject public  CountryAuthnRequestGeneratorService(CountrySingleSignOnServiceHelper countrySingleSignOnServiceHelper,
                                               Function<EidasAuthnRequestFromHub, String> eidasRequestStringTransformer,
                                               EidasAuthnRequestTranslator eidasAuthnRequestTranslator,
                                               String hubEidasEntityId);

}