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

import java.util.Collections;
import java.util.Map;

/**
 * Binary data wrapper.
 * Contains binary data and the (file) name.
 */
public class DataWrapper {

    private final byte[] data;
    private final String name;
    private final String type;
    private final Map<String, String> attributes;

    /**
     * Constructor.
     *
     * @param data Binary data.
     * @param name Data (file) name.
     * @param type Document type.
     * @param attributes Document attributes.
     */
    public DataWrapper(final byte[] data, final String name, final String type, final Map<String, String> attributes) {
        this.data = data;
        this.name = name;
        this.type = type;
        this.attributes = (attributes == null) ? Collections.emptyMap() : attributes;
    }

    public byte[] getData() {
        return data;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    @Override
    public String toString() {
        return "DataWrapper{name='" + name + "', type='" + type + "', attributes='" + attributes + "'}";
    }
}
