package com.example.samplejavaapp.processing;

import androidx.annotation.NonNull;

import com.example.samplejavaapp.MainActivity;
import com.example.samplejavaapp.wrappers.event.JEventHandler;

import pl.novelpay.app2app.model.state.AuthorisationTransactionState;
import pl.novelpay.app2app.model.state.PaymentTransactionState;
import pl.novelpay.client.sdk.communication.processor.ObservableEvent;
import pl.novelpay.util.logger.Logger;

public class EventObserver extends JEventHandler {
    @Override
    public void onPaymentAppIDLE() {
        toForeground(MainActivity.class);
    }

    @Override
    public void onServerEvent(@NonNull ObservableEvent.ServerEvent event) {
        Logger.INSTANCE.d("Some server event occurred");
    }

    @Override
    public void onPaymentAppAuthorisation(@NonNull AuthorisationTransactionState event) {
        Logger.INSTANCE.d("Payment App is in Authorisation state");
        toForeground(MainActivity.class);
    }

    @Override
    public void onPaymentAppProcessing(@NonNull PaymentTransactionState event) {
        Logger.INSTANCE.d("Payment App is in Processing state");
        toForeground(MainActivity.class);
    }
}
