//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Bajun.Network.NET.RestClient.Generated.Clients
{
   using System;
   using System.Threading.Tasks;
   using System.Net.Http;
   using Bajun.Network.NET.NetApiExt.Generated.Model.pallet_preimage;
   using Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec;
   using Bajun.Network.NET.RestClient.Generated.Interfaces;
   
   public sealed class PreimageControllerClient : BaseClient, IPreimageControllerClient
   {
      private HttpClient _httpClient;
      private BaseSubscriptionClient _subscriptionClient;
      public PreimageControllerClient(HttpClient httpClient, BaseSubscriptionClient subscriptionClient)
      {
         _httpClient = httpClient;
         _subscriptionClient = subscriptionClient;
      }
      public async Task<EnumRequestStatus> GetStatusFor(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key)
      {
         return await SendRequestAsync<EnumRequestStatus>(_httpClient, "preimage/statusfor", Bajun.Network.NET.NetApiExt.Generated.Storage.PreimageStorage.StatusForParams(key));
      }
      public async Task<bool> SubscribeStatusFor(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key)
      {
         return await _subscriptionClient.SubscribeAsync("Preimage.StatusFor", Bajun.Network.NET.NetApiExt.Generated.Storage.PreimageStorage.StatusForParams(key));
      }
      public async Task<BoundedVecT20> GetPreimageFor(Ajuna.NetApi.Model.Types.Base.BaseTuple<Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256, Ajuna.NetApi.Model.Types.Primitive.U32> key)
      {
         return await SendRequestAsync<BoundedVecT20>(_httpClient, "preimage/preimagefor", Bajun.Network.NET.NetApiExt.Generated.Storage.PreimageStorage.PreimageForParams(key));
      }
      public async Task<bool> SubscribePreimageFor(Ajuna.NetApi.Model.Types.Base.BaseTuple<Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256, Ajuna.NetApi.Model.Types.Primitive.U32> key)
      {
         return await _subscriptionClient.SubscribeAsync("Preimage.PreimageFor", Bajun.Network.NET.NetApiExt.Generated.Storage.PreimageStorage.PreimageForParams(key));
      }
   }
}
