package kz.com.aman.kassa.bank;

import android.widget.Toast;

import ru.m4bank.mpos.library.external.configuration.CheckConnectionCallbackHandler;
import ru.m4bank.mpos.service.result.CheckConnectionExternalResult;

public class CheckConnectionCallbackHandlerImpl implements CheckConnectionCallbackHandler {
    private final M4BankActivity activity;

    public CheckConnectionCallbackHandlerImpl(M4BankActivity activity) {
        this.activity = activity;
    }

    @Override
    public void onCompleted(CheckConnectionExternalResult result) {
        activity.runOnUiThread(() -> Toast.makeText(activity, result.getResultType() + " " + (result.getDescription() == null ? "" : result.getDescription()) + " " + result.isOnlineRegistration(), Toast.LENGTH_SHORT).show());
    }

    @Override
    public void onWrongApiCalled() {
        activity.runOnUiThread(() -> Toast.makeText(activity, "Wrong method has been called", Toast.LENGTH_SHORT).show());
    }
}
