package kz.com.aman.kassa.bank;

import android.widget.Toast;

import ru.m4bank.mpos.library.external.authorization.LogOutCallbackHandler;
import ru.m4bank.mpos.service.result.Result;

public class LogOutCallbackHandlerImpl implements LogOutCallbackHandler {
    private final M4BankActivity activity;

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

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

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

    @Override
    public void notAuthorized() {
        activity.runOnUiThread(() -> Toast.makeText(activity, "Not authorized", Toast.LENGTH_SHORT).show());
    }
}
