package com.avg.zaap.crashlibrary.offline;

import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.avg.zaap.crashlibrary.ConnectionStatus;

/**
 * This interface denotes the common behavior for the connectivity helpers.
 * <p/>
 * Created by marek.osvald on 27.7.2016.
 */
public interface IConnectivityHelper {

    /**
     * Returns the current connection status structure.
     *
     * @return current connection status structure
     */
    @NonNull
    ConnectionStatus getConnectionStatus();

    /**
     * Reads given network info and returns appropriate connection status structure.
     *
     * @param networkInfo network info to read
     * @return connection status structure
     */
    @NonNull
    ConnectionStatus processNetworkInfo(@Nullable NetworkInfo networkInfo);

    /**
     * Returns whether current connectivity is suitable for the crash reporting based on the
     * {@link com.avg.zaap.crashlibrary.config.CrashLibConfig} settings.
     *
     * @param connectionStatus connection status to check for suitability
     * @return true, provided that the connection is suitable for crash reporting, false otherwise
     */
    boolean isConnectivitySuitable(ConnectionStatus connectionStatus);

}
