package com.avg.zaap.crashlibrary;

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

import com.avg.zaap.crashlibrary.offline.ConnectivityHelper;
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.offline.publisher.OfflinePublisher;
import com.avg.zaap.crashlibrary.publish.packer.BinPacker;
import com.avg.zaap.crashlibrary.publish.packer.IBinPacker;

import java.io.File;

/**
 * This class serves as the default dependency factory for the crash publishing delegate.
 * <p/>
 * Created by marek.osvald on 1.7.2016.
 */
public class CrashPublishingDelegateFactory implements ICrashPublishingDelegateFactory {

    @Override
    public Thread getThread(Runnable runnable) {
        return new Thread(runnable);
    }

    @Override
    public IBinPacker getBinPacker(String filePath) throws IBinPacker.BinPackerException {
        return new BinPacker(filePath);
    }

    @Override
    public File openFile(String filePath) {
        return new File(filePath);
    }

    @Override
    public IConnectivityHelper getConnectivityHelper(Context context) {
        return new ConnectivityHelper(context);
    }

    @Override
    public IOfflinePublisher getOfflinePublisher(@NonNull IOfflinePublisherCallback callback) {
        return new OfflinePublisher(callback);
    }

}
