class GitPushEventProcessor implements GitEventProcessor {

    @Override
    public void processEvent(final GitEvent event) {
        if (!validateEvent(event)) {
            return;
        }
        log.debug("Processing git event: {}", event);
        if (!defaultBranch.equals(event.getReference())) {
            log.debug("Skipping non default branch: {}", event.getReference());
            return;
        }
        fetchPipeline(event, apiClient)
                .ifPresent(pipeline -> ListUtils.emptyIfNull(event.getCommits())
                        .stream()
                        .map(commit -> {
                            final List<PipelineEvent> events = new ArrayList<>();
                            final List<String> updated = ListUtils.union(
                                    filterPaths(commit.getAdded()),
                                    filterPaths(commit.getModified()));
                            buildEvent(commit, EventType.UPDATE, updated, pipeline.getId()).ifPresent(events::add);
                            final List<String> deleted = filterPaths(commit.getRemoved());
                            buildEvent(commit, EventType.DELETE, deleted, pipeline.getId()).ifPresent(events::add);
                            log.debug("Processing events: {}", events);
                            return events;
                        })
                        .filter(CollectionUtils::isNotEmpty)
                        .flatMap(Collection::stream)
                        .forEach(eventDao::createPipelineEvent));
    }

    public  GitPushEventProcessor(final PipelineEventDao eventDao,
                                 final CloudPipelineAPIClient apiClient,
                                 final ObjectMapper objectMapper,
                                 @Value("${sync.pipeline-code.default-branch}") final String defaultBranch,
                                 @Value("${sync.pipeline-code.index.paths}") final String indexedPaths);

}