package kz.com.aman.kassa.bank;

import android.widget.Toast;

import java.util.List;

import ru.m4bank.mpos.library.external.transactions.EasyReversalSavedOperationCallbackHandler;
import ru.m4bank.mpos.service.data.FiscalStatusData;
import ru.m4bank.mpos.service.hardware.error.ErrorHandler;
import ru.m4bank.mpos.service.result.PrinterResult;
import ru.m4bank.mpos.service.result.Result;
import ru.m4bank.mpos.service.transactions.data.TransactionData;
import ru.m4bank.mpos.service.transactions.data.TransactionExecutionStatus;
import ru.m4bank.mpos.service.transactions.data.error.TransactionErrorData;

public class EasyReversalSavedOperationCallbackHandlerImpl implements EasyReversalSavedOperationCallbackHandler {
    private M4BankActivity activity;

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

    @Override
    public void onTransactionIsNotReversible() {
        showMessage("onTransactionIsNotReversible");
    }

    @Override
    public void onSelectTransaction() {
        showMessage("onSelectTransaction");
    }

    @Override
    public void onCompletedPrinting(PrinterResult result) {
        showMessage("onCompletedPrinting");
    }

    @Override
    public void onStatusFiscalModule(FiscalStatusData fiscalStatusDatat) {
        showMessage("onStatusFiscalModule");
    }

    @Override
    public void onTransactionSelectionRequested(List list) {
        showMessage("onTransactionSelectionRequested");
    }

    @Override
    public void onCardShortPanRequested() {
        showMessage("onCardShortPanRequested");
    }

    @Override
    public void notAuthorized() {
        showMessage("notAuthorized");
    }

    @Override
    public void onCompleted(Result result) {
        showMessage("onCompleted");
    }

    @Override
    public void onWrongApiCalled() {
        showMessage("onWrongApiCalled");
    }

    @Override
    public void onRequestedReportZ() {
        showMessage("onRequestedReportZ");
    }

    @Override
    public void onTransactionInit() {
        showMessage("onTransactionInit");
    }

    @Override
    public void onTransactionExecutionStatusChanged(TransactionExecutionStatus newStatus) {
        showMessage("onTransactionExecutionStatusChanged: ");
    }

    @Override
    public void onUserInformationRequested(boolean signNeeded) {
        showMessage("onUserInformationRequested");
    }

    @Override
    public void onError(ErrorHandler errorHandler, TransactionErrorData errorData) {
        showMessage("onError");
    }

    @Override
    public void onErrorWithPossibilityToRetry(ErrorHandler errorHandler) {
        showMessage("onErrorWithPossibilityToRetry");
    }

    @Override
    public void onTransactionDataReceivedError(TransactionData data) {
        showMessage("onTransactionDataReceivedError");
    }

    @Override
    public void onTransactionDataReceived(TransactionData data) {
        showMessage("onTransactionDataReceived");
    }

    @Override
    public void onTransactionCompleted() {
        showMessage("onTransactionCompleted");
    }

    @Override
    public void onRepeat(int attemptNumber) {
        showMessage("onRepeat");
    }

    @Override
    public void onPrinterForRegistrationGettingCompleted() {
        showMessage("onPrinterForRegistrationGettingCompleted");
    }

    @Override
    public void onNoBoundedPrinterFound() {
        showMessage("onNoBoundedPrinterFound");
    }

    @Override
    public void onPrinterToUseSelectionRequested(List printerList) {
        showMessage("onPrinterToUseSelectionRequested");
    }

    private void showMessage(String message) {
        activity.runOnUiThread(() -> Toast.makeText(activity, message, Toast.LENGTH_LONG).show());
    }
}
