package it.integry.integrywmsnative.core.wifi;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import it.integry.integrywmsnative.core.expansion.RunnableArgs;

public class WiFiCheckerViewHolder implements RunnableArgs<WiFiStatusChecker.SIGNAL> {

    private TextView mWifiSignalTextView;

    private WiFiStatusChecker mWiFiStatusChecker;

    public WiFiCheckerViewHolder(Context context, View view, int rsid){
        mWifiSignalTextView = view.findViewById(rsid);

        mWiFiStatusChecker = new WiFiStatusChecker(context);
    }


    public void startMonitoring(){
        mWiFiStatusChecker.startMonitoring(this);
    }

    public void stopMonitoring(){
        mWiFiStatusChecker.stopMonitoring();
    }


    @Override
    public void run(WiFiStatusChecker.SIGNAL value) {
        switch (value){
            case EXCELLENT:
                mWifiSignalTextView.setText("ECCELLENTE");
                break;
            case GOOD:
                mWifiSignalTextView.setText("BUONO");
                break;
            case FAIR:
                mWifiSignalTextView.setText("SUFFICIENTE");
                break;
            case WEAK:
                mWifiSignalTextView.setText("SCARSO");
                break;
            case NONE:
                mWifiSignalTextView.setText("NESSUNO");
                break;
        }
    }
}
