class CopybaraGenerator {

    public String generateOriginFilesConfig() {
        SortedSet<DefinitionsChildId> allDefinitionsChildIds = repository.getAllDefinitionsChildIds();
        return allDefinitionsChildIds.stream()
            .filter(id -> {
                RepositoryFileReference repositoryFileReference = new RepositoryFileReference(id, Constants.LICENSE_FILE_NAME);
                if (!repository.exists(repositoryFileReference)) {
                    return false;
                }
                try (InputStream inputStream = repository.newInputStream(repositoryFileReference)) {
                    // we put the whole license file text into a string and check if it starts with "Apache License" after
                    // trimming it
                    final String licenceString = "Apache License";
                    String fileAsString = IOUtils.toString(inputStream);

                    return fileAsString.trim().startsWith(licenceString);
                } catch (IOException e) {
                    LOGGER.error("Could not create input stream for {}", repositoryFileReference.toString(), e);
                    return false;
                }
            })
            .map(id -> BackendUtils.getPathInsideRepo(id))
            .collect(Collectors.joining("**\",\n        \"", "origin_files = glob([\"README.md\", \"LICENSE\", \"", "**\"]),"));
    }

    public  CopybaraGenerator();
    public  CopybaraGenerator(IRepository repository);

}