class ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider {

    public Images getImagesFromDefault(Long workspaceId, String stackName, String platform, Set<String> operatingSystems)
            throws CloudbreakImageCatalogException {
        if (isNotEmpty(platform) && isNotEmpty(stackName)) {
            throw new BadRequestException("Platform or stackName cannot be filled in the same request.");
        }
        if (isNotEmpty(platform)) {
            User user = getLoggedInUser();
            ImageFilter imageFilter = new ImageFilter(getDefaultImageCatalog(user), Set.of(platform), null, baseImageEnabled(), operatingSystems, null);
            return getStatedImagesFilteredByOperatingSystems(imageFilter, image -> true).getImages();
        } else if (isNotEmpty(stackName)) {
            return stackImageFilterService.getApplicableImages(workspaceId, stackName);
        } else {
            throw new BadRequestException("Either platform or stackName should be filled in request.");
        }
    }

}