#![allow(clippy::all)]

use multiversx_sc::proxy_imports::*;

pub struct DnsProxy;

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

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

pub struct DnsProxyMethods<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, To, Gas> DnsProxyMethods<Env, From, To, Gas>
where
    Env: TxEnv,
    Env::Api: VMApi,
    From: TxFrom<Env>,
    To: TxTo<Env>,
    Gas: TxGas<Env>,
{
    pub fn register<
        Arg0: ProxyArg<ManagedBuffer<Env::Api>>,
    >(
        self,
        name: Arg0,
    ) -> TxTypedCall<Env, From, To, (), Gas, ()> {
        self.wrapped_tx
            .raw_call("register")
            .argument(&name)
            .original_result()
    }
}
