package com.workfusion.odf.impl.converter.extractor.mail;

import java.io.InputStream;
import java.util.List;

import org.slf4j.Logger;

import com.workfusion.odf.impl.converter.extractor.DataWrapper;
import com.workfusion.odf.service.mail.entity.EmailMessage;
import com.workfusion.odf.service.mail.util.EmailParsingUtils;

public class RecursiveMsgExtractor extends AbstractMailExtractor {
    public static final String MSG = "msg";
    private static final String MAIL_SUFFIXES[] = {MSG};

    /**
     * Constructor.
     *
     * @param logger
     */
    public RecursiveMsgExtractor(final Logger logger) {
    	super(logger);
    }

    @Override
    public String[] getExtensions() {
        return MAIL_SUFFIXES;
    }

    @Override
    protected EmailMessage parseMessage(final InputStream contentIS, final String extension) {
        return EmailParsingUtils.parseMsgFile(contentIS, extension);
    }

    @Override
    public List<DataWrapper> recursiveExtract(final byte[] data, final String name) {
        return recursiveExtract(new DataWrapper(data, "root.msg", null, null));
    }
}
