package com.avg.zaap.crashlibrary;

import android.content.Context;
import android.support.annotation.NonNull;

import com.avg.zaap.crashlibrary.offline.IConnectivityHelper;
import com.avg.zaap.crashlibrary.offline.publisher.IOfflinePublisher;
import com.avg.zaap.crashlibrary.offline.publisher.IOfflinePublisherCallback;
import com.avg.zaap.crashlibrary.publish.packer.IBinPacker;

import java.io.File;

/**
 * This interface denotes the common behavior for the crash publishing delegate dependency
 * factories.
 * <p/>
 * Created by marek.osvald on 1.7.2016.
 */
public interface ICrashPublishingDelegateFactory {

    /**
     * Returns a new thread instance.
     *
     * @param runnable runnable instance to initialize the thread with
     * @return a new thread instance
     */
    Thread getThread(Runnable runnable);

    /**
     * Returns an instance of binary packer.
     *
     * @param filePath filepath to initialize the binary packer with
     * @return an instance of binary packer
     * @throws IBinPacker.BinPackerException provided that the binary packer initialization fails
     */
    IBinPacker getBinPacker(String filePath) throws IBinPacker.BinPackerException;

    /**
     * Returns a file instance for given filepath.
     *
     * @param filePath file path to return the file instance for
     * @return a file instance for given filepath
     */
    File openFile(String filePath);

    /**
     * Returns an instance of connectivity helper.
     *
     * @param context Android context instance
     * @return an instance of connectivity helper
     */
    IConnectivityHelper getConnectivityHelper(Context context);

    /**
     * Returns an instance of offline publisher.
     *
     * @param callback offline publisher callback instance
     * @return an instance of offline publisher
     */
    IOfflinePublisher getOfflinePublisher(@NonNull IOfflinePublisherCallback callback);

}
