package com.epson.iprint.prtlogger;

import android.content.Context;


import com.epson.mobilephone.common.EpLog;

import epson.provider.SharedPreferencesProvider;

public class AnalyticsPreferences {
    private static final String PREFS_KEY_CONNECTION_PATH = "connection_path";
    private static final String PREFS_KEY_ONLINE_STORAGE_TYPE = "online_storage_type";
    private static final String PREFS_KEY_PRINT_NUMBER = "print_num";
    public static final String PREFS_NAME = "analytics_prefs";

    public static void saveConnectionPath(@NonNull Context context, int i) {
        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_CONNECTION_PATH, i).apply(PREFS_NAME);
    }

    public static int getConnectionPath(@NonNull Context context) {
        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_CONNECTION_PATH, -1);
    }

    public static void savePrintNumber(@NonNull Context context, int i) {
        EpLog.m77i("    printNumber = " + i);
        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_PRINT_NUMBER, i).apply(PREFS_NAME);
    }

    public static int getPrintNumber(@NonNull Context context) {
        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_PRINT_NUMBER, 0);
    }

    public static void saveOnlineStorageType(@NonNull Context context, int i) {
        SharedPreferencesProvider.getInstace(context, PREFS_NAME).edit().putInt(PREFS_KEY_ONLINE_STORAGE_TYPE, i).apply(PREFS_NAME);
    }

    private static int getOnlineStorageType(@NonNull Context context) {
        return SharedPreferencesProvider.getInstace(context, PREFS_NAME).getInt(PREFS_KEY_ONLINE_STORAGE_TYPE, -1);
    }
}
