class StackToDescribeFreeIpaResponseConverter {

    public DescribeFreeIpaResponse convert(Stack stack, ImageEntity image, FreeIpa freeIpa, UserSyncStatus userSyncStatus) {
        DescribeFreeIpaResponse describeFreeIpaResponse = new DescribeFreeIpaResponse();
        describeFreeIpaResponse.setName(stack.getName());
        describeFreeIpaResponse.setEnvironmentCrn(stack.getEnvironmentCrn());
        describeFreeIpaResponse.setCrn(stack.getResourceCrn());
        describeFreeIpaResponse.setCloudPlatform(stack.getCloudPlatform());
        describeFreeIpaResponse.setAuthentication(authenticationResponseConverter.convert(stack.getStackAuthentication()));
        Optional.ofNullable(image).ifPresent(i -> describeFreeIpaResponse.setImage(imageSettingsResponseConverter.convert(i)));
        Optional.ofNullable(freeIpa).ifPresent(f -> describeFreeIpaResponse.setFreeIpa(freeIpaServerResponseConverter.convert(f)));
        describeFreeIpaResponse.setNetwork(networkResponseConverter.convert(stack));
        describeFreeIpaResponse.setPlacement(convert(stack));
        describeFreeIpaResponse.setInstanceGroups(instanceGroupConverter.convert(stack.getInstanceGroups()));
        describeFreeIpaResponse.setStatus(stack.getStackStatus().getStatus());
        describeFreeIpaResponse.setStatusString(stack.getStackStatus().getStatusString());
        describeFreeIpaResponse.setStatusReason(stack.getStackStatus().getStatusReason());
        decorateFreeIpaServerResponseWithIps(describeFreeIpaResponse.getFreeIpa(), describeFreeIpaResponse.getInstanceGroups());
        decoreateFreeIpaServerResponseWithLoadBalancedHost(stack, describeFreeIpaResponse.getFreeIpa(), freeIpa);
        describeFreeIpaResponse.setAppVersion(stack.getAppVersion());
        decorateWithCloudStorgeAndTelemetry(stack, describeFreeIpaResponse);
        Optional.ofNullable(userSyncStatus).ifPresent(u -> describeFreeIpaResponse.setUserSyncStatus(userSyncStatusConverter.convert(u)));
        return describeFreeIpaResponse;
    }

}