package com.example.samplejavaapp.wrappers.sdk

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import pl.novelpay.client.core.Client
import pl.novelpay.retailer.message.payment.PaymentType
import pl.novelpay.transport.converter.utls.RetailerAdminExtension
import pl.novelpay.util.domain.payment.PaymentAmounts
import pl.novelpay.util.domain.transactionStatus.MessageReference

class JClient constructor(private val client: Client) :
    CoroutineScope by CoroutineScope(Dispatchers.IO) {

    fun sendAdminRequest(adminExtension: RetailerAdminExtension) = launch {
        client.sendAdminRequest(adminExtension)
    }

    fun sendLoginRequest() = launch {
        client.sendLoginRequest()
    }

    fun sendLogoutRequest() = launch {
        client.sendLogoutRequest()
    }

    fun sendPaymentRequest(
        saleReferenceId: String,
        transactionID: String,
        paymentAmounts: PaymentAmounts,
        paymentType: PaymentType
    ) = launch {
        client.sendPaymentRequest(saleReferenceId, transactionID, paymentAmounts, paymentType)
    }

    fun sendTransactionStatusRequest(messageReference: MessageReference) = launch {
        client.sendTransactionStatusRequest(messageReference)
    }
}