package org.telegram.tgnet;


import android.util.Log;

public class ConnectionsManager {




    private int currentAccount = 0;
    private static volatile ConnectionsManager[] Instance = new ConnectionsManager[3];


    public ConnectionsManager() {


        native_init(0, 1358, 85, 41962, "OnePlusA0001", "OnePlusA0001", "4.9.1 (13580)", "us", "us", "/data/user/0/org.telegram.messenger.beta/files", "", 0, true, true, 0);
    }


    public long checkProxy(String address, int port,  String secret, RequestTimeDelegate requestTimeDelegate) {

        return native_checkProxy(currentAccount, address, port, "", "", secret, requestTimeDelegate);
    }


    public static void setProxySettings(String address, int port, String secret) {


        native_setProxySettings(0, address, port, "", "", secret);


    }

    public static native void native_switchBackend(int currentAccount);

    public static native int native_isTestBackend(int currentAccount);

    public static native void native_pauseNetwork(int currentAccount);

    public static native void native_setUseIpv6(int currentAccount, boolean value);

    public static native void native_updateDcSettings(int currentAccount);

    public static native void native_setNetworkAvailable(int currentAccount, boolean value, int networkType, boolean slow);

    public static native void native_resumeNetwork(int currentAccount, boolean partial);

    public static native long native_getCurrentTimeMillis(int currentAccount);

    public static native int native_getCurrentTime(int currentAccount);

    public static native int native_getTimeDifference(int currentAccount);

    public static native void native_sendRequest(int currentAccount, long object, RequestDelegateInternal onComplete, QuickAckDelegate onQuickAck, WriteToSocketDelegate onWriteToSocket, int flags, int datacenterId, int connetionType, boolean immediate, int requestToken);

    public static native void native_cancelRequest(int currentAccount, int token, boolean notifyServer);

    public static native void native_cleanUp(int currentAccount, boolean resetKeys);

    public static native void native_cancelRequestsForGuid(int currentAccount, int guid);

    public static native void native_bindRequestToGuid(int currentAccount, int requestToken, int guid);

    public static native void native_applyDatacenterAddress(int currentAccount, int datacenterId, String ipAddress, int port);

    public static native int native_getConnectionState(int currentAccount);

    public static native void native_setUserId(int currentAccount, int id);

    public static native void native_init(int currentAccount, int version, int layer, int apiId, String deviceModel, String systemVersion, String appVersion, String langCode, String systemLangCode, String configPath, String logPath, int userId, boolean enablePushConnection, boolean hasNetwork, int networkType);

    public static native void native_setProxySettings(int currentAccount, String address, int port, String username, String password, String secret);

    public static native void native_setLangCode(int currentAccount, String langCode);

    public static native void native_setJava(boolean useJavaByteBuffers);

    public static native void native_setPushConnectionEnabled(int currentAccount, boolean value);

    public static native void native_applyDnsConfig(int currentAccount, long address, String phone);

    public static native long native_checkProxy(int currentAccount, String address, int port, String username, String password, String secret, RequestTimeDelegate requestTimeDelegate);


    public static boolean isRoaming() {

        return false;
    }

    public static boolean isConnectedOrConnectingToWiFi() {

        return false;
    }

    public static boolean isConnectedToWiFi() {

        return false;
    }


    public void setAppPaused(final boolean value, final boolean byScreenState) {


    }

    public static void onUnparsedMessageReceived(long address, final int currentAccount) {

    }

    public static void onUpdate(final int currentAccount) {

    }


    public static int getCurrentNetworkType() {
        return 0;
    }


    protected static boolean useIpv6Address() {
        return false;
    }


    public static boolean isNetworkOnline() {
        return true;
    }

    public static void setLangCode(String langCode) {

    }


    public static void onSessionCreated(final int currentAccount) {

    }

    public static void onConnectionStateChanged(final int state, final int currentAccount) {

    }

    public static void onLogout(final int currentAccount) {

    }


    public static int getInitFlags() {
        return 0;
    }

    public static void onBytesSent(int amount, int networkType, final int currentAccount) {

    }

    public static void onRequestNewServerIpAndPort(final int second, final int currentAccount) {

    }

    public static void onProxyError() {

    }

    public static String getHostByName(String domain, final int currentAccount) {

        return "";
    }

    public static void onBytesReceived(int amount, int networkType, final int currentAccount) {

    }

    public static void onUpdateConfig(long address, final int currentAccount) {

    }

    public static void onInternalPushReceived(final int currentAccount) {

    }

}
