// Code generated by the multiversx-sc proxy generator. DO NOT EDIT.

////////////////////////////////////////////////////
////////////////// AUTO-GENERATED //////////////////
////////////////////////////////////////////////////

#![allow(dead_code)]
#![allow(clippy::all)]

use multiversx_sc::proxy_imports::*;

pub struct ForwarderQueueProxy;

impl<Env, From, To, Gas> TxProxyTrait<Env, From, To, Gas> for ForwarderQueueProxy
where
    Env: TxEnv,
    From: TxFrom<Env>,
    To: TxTo<Env>,
    Gas: TxGas<Env>,
{
    type TxProxyMethods = ForwarderQueueProxyMethods<Env, From, To, Gas>;

    fn proxy_methods(self, tx: Tx<Env, From, To, (), Gas, (), ()>) -> Self::TxProxyMethods {
        ForwarderQueueProxyMethods { wrapped_tx: tx }
    }
}

pub struct ForwarderQueueProxyMethods<Env, From, To, Gas>
where
    Env: TxEnv,
    From: TxFrom<Env>,
    To: TxTo<Env>,
    Gas: TxGas<Env>,
{
    wrapped_tx: Tx<Env, From, To, (), Gas, (), ()>,
}

#[rustfmt::skip]
impl<Env, From, Gas> ForwarderQueueProxyMethods<Env, From, (), Gas>
where
    Env: TxEnv,
    Env::Api: VMApi,
    From: TxFrom<Env>,
    Gas: TxGas<Env>,
{
    pub fn init(
        self,
    ) -> TxTypedDeploy<Env, From, NotPayable, Gas, ()> {
        self.wrapped_tx
            .payment(NotPayable)
            .raw_deploy()
            .original_result()
    }
}

#[rustfmt::skip]
impl<Env, From, To, Gas> ForwarderQueueProxyMethods<Env, From, To, Gas>
where
    Env: TxEnv,
    Env::Api: VMApi,
    From: TxFrom<Env>,
    To: TxTo<Env>,
    Gas: TxGas<Env>,
{
    pub fn queued_calls(
        self,
    ) -> TxTypedCall<Env, From, To, NotPayable, Gas, MultiValueEncoded<Env::Api, QueuedCall<Env::Api>>> {
        self.wrapped_tx
            .payment(NotPayable)
            .raw_call("queued_calls")
            .original_result()
    }

    pub fn add_queued_call_sync<
        Arg0: ProxyArg<ManagedAddress<Env::Api>>,
        Arg1: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg2: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        to: Arg0,
        endpoint_name: Arg1,
        args: Arg2,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call_sync")
            .argument(&to)
            .argument(&endpoint_name)
            .argument(&args)
            .original_result()
    }

    pub fn add_queued_call_legacy_async<
        Arg0: ProxyArg<ManagedAddress<Env::Api>>,
        Arg1: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg2: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        to: Arg0,
        endpoint_name: Arg1,
        args: Arg2,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call_legacy_async")
            .argument(&to)
            .argument(&endpoint_name)
            .argument(&args)
            .original_result()
    }

    pub fn add_queued_call_transfer_execute<
        Arg0: ProxyArg<ManagedAddress<Env::Api>>,
        Arg1: ProxyArg<u64>,
        Arg2: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg3: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        to: Arg0,
        gas_limit: Arg1,
        endpoint_name: Arg2,
        args: Arg3,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call_transfer_execute")
            .argument(&to)
            .argument(&gas_limit)
            .argument(&endpoint_name)
            .argument(&args)
            .original_result()
    }

    pub fn add_queued_call_transfer_esdt<
        Arg0: ProxyArg<ManagedAddress<Env::Api>>,
        Arg1: ProxyArg<u64>,
        Arg2: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg3: ProxyArg<TokenIdentifier<Env::Api>>,
        Arg4: ProxyArg<BigUint<Env::Api>>,
        Arg5: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        to: Arg0,
        gas_limit: Arg1,
        endpoint_name: Arg2,
        token: Arg3,
        amount: Arg4,
        args: Arg5,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call_transfer_esdt")
            .argument(&to)
            .argument(&gas_limit)
            .argument(&endpoint_name)
            .argument(&token)
            .argument(&amount)
            .argument(&args)
            .original_result()
    }

    pub fn add_queued_call_promise<
        Arg0: ProxyArg<ManagedAddress<Env::Api>>,
        Arg1: ProxyArg<u64>,
        Arg2: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg3: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        to: Arg0,
        gas_limit: Arg1,
        endpoint_name: Arg2,
        args: Arg3,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call_promise")
            .argument(&to)
            .argument(&gas_limit)
            .argument(&endpoint_name)
            .argument(&args)
            .original_result()
    }

    pub fn add_queued_call<
        Arg0: ProxyArg<QueuedCallType>,
        Arg1: ProxyArg<ManagedAddress<Env::Api>>,
        Arg2: ProxyArg<u64>,
        Arg3: ProxyArg<ManagedBuffer<Env::Api>>,
        Arg4: ProxyArg<MultiValueEncoded<Env::Api, ManagedBuffer<Env::Api>>>,
    >(
        self,
        call_type: Arg0,
        to: Arg1,
        gas_limit: Arg2,
        endpoint_name: Arg3,
        args: Arg4,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("add_queued_call")
            .argument(&call_type)
            .argument(&to)
            .argument(&gas_limit)
            .argument(&endpoint_name)
            .argument(&args)
            .original_result()
    }

    pub fn forward_queued_calls(
        self,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("forward_queued_calls")
            .original_result()
    }

    pub fn callback_count(
        self,
    ) -> TxTypedCall<Env, From, To, NotPayable, Gas, usize> {
        self.wrapped_tx
            .payment(NotPayable)
            .raw_call("callback_count")
            .original_result()
    }

    pub fn callback_payments(
        self,
    ) -> TxTypedCall<Env, From, To, NotPayable, Gas, ManagedBuffer<Env::Api>> {
        self.wrapped_tx
            .payment(NotPayable)
            .raw_call("callback_payments")
            .original_result()
    }
}

#[type_abi]
#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)]
pub struct QueuedCall<Api>
where
    Api: ManagedTypeApi,
{
    pub call_type: QueuedCallType,
    pub to: ManagedAddress<Api>,
    pub gas_limit: u64,
    pub endpoint_name: ManagedBuffer<Api>,
    pub args: ManagedArgBuffer<Api>,
    pub payments: EgldOrMultiEsdtPayment<Api>,
}

#[type_abi]
#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)]
pub enum QueuedCallType {
    Sync,
    LegacyAsync,
    TransferExecute,
    Promise,
}
