package com.workfusion.odf.impl.processor.extractor;

import java.util.function.Predicate;

import javax.inject.Inject;

import org.slf4j.Logger;

import com.workfusion.odf.api.domain.Document;
import com.workfusion.odf.impl.converter.extractor.AbstractRecursiveExtractor;
import com.workfusion.odf.impl.converter.extractor.mail.RecursiveEmlExtractor;
import com.workfusion.odf.processor.TransactionProcessor;
import com.workfusion.rpa.core.storage.S3Manager;

/**
 * @author Andrei Urbanovich
 */
public class EmlFlatMapProcessor extends AbstractFlatMapper implements TransactionProcessor {
    private final static String S3_FOLDER = "eml_flatMap";

    @Inject
    public EmlFlatMapProcessor(final S3Manager s3Manager, final Logger logger) {
        super(s3Manager, logger);
    }

    @Override
    protected Predicate<Document> getDocumentFilter() {
        return Document::isEmlDocument;
    }

    @Override
    protected AbstractRecursiveExtractor getRecursiveExtractor() {
        return new RecursiveEmlExtractor(logger);
    }

    @Override
    protected String getS3Folder() {
        return S3_FOLDER;
    }
}
