//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------

using Ajuna.NetApi.Model.Types.Base;
using Ajuna.ServiceLayer.Attributes;
using Ajuna.ServiceLayer.Storage;
using System.Collections.Generic;
using System.Threading.Tasks;


namespace Bajun.Network.NET.RestService.Generated.Storage
{
    
    
    /// <summary>
    /// IDmpQueueStorage interface definition.
    /// </summary>
    public interface IDmpQueueStorage : IStorage
    {
        
        /// <summary>
        /// >> Configuration
        ///  The configuration.
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.ConfigData GetConfiguration();
        
        /// <summary>
        /// >> PageIndex
        ///  The page index.
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.PageIndexData GetPageIndex();
        
        /// <summary>
        /// >> Pages
        ///  The queue pages.
        /// </summary>
        Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>> GetPages(string key);
        
        /// <summary>
        /// >> Overweight
        ///  The overweight messages.
        /// </summary>
        Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>> GetOverweight(string key);
    }
    
    /// <summary>
    /// DmpQueueStorage class definition.
    /// </summary>
    public sealed class DmpQueueStorage : IDmpQueueStorage
    {
        
        /// <summary>
        /// _configurationTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.ConfigData> _configurationTypedStorage;
        
        /// <summary>
        /// _pageIndexTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.PageIndexData> _pageIndexTypedStorage;
        
        /// <summary>
        /// _pagesTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>>> _pagesTypedStorage;
        
        /// <summary>
        /// _overweightTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>> _overweightTypedStorage;
        
        /// <summary>
        /// DmpQueueStorage constructor.
        /// </summary>
        public DmpQueueStorage(IStorageDataProvider storageDataProvider, List<IStorageChangeDelegate> storageChangeDelegates)
        {
            this.ConfigurationTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.ConfigData>("DmpQueue.Configuration", storageDataProvider, storageChangeDelegates);
            this.PageIndexTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.PageIndexData>("DmpQueue.PageIndex", storageDataProvider, storageChangeDelegates);
            this.PagesTypedStorage = new TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>>>("DmpQueue.Pages", storageDataProvider, storageChangeDelegates);
            this.OverweightTypedStorage = new TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>>("DmpQueue.Overweight", storageDataProvider, storageChangeDelegates);
        }
        
        /// <summary>
        /// _configurationTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.ConfigData> ConfigurationTypedStorage
        {
            get
            {
                return _configurationTypedStorage;
            }
            set
            {
                _configurationTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _pageIndexTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.PageIndexData> PageIndexTypedStorage
        {
            get
            {
                return _pageIndexTypedStorage;
            }
            set
            {
                _pageIndexTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _pagesTypedStorage property
        /// </summary>
        public TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>>> PagesTypedStorage
        {
            get
            {
                return _pagesTypedStorage;
            }
            set
            {
                _pagesTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _overweightTypedStorage property
        /// </summary>
        public TypedMapStorage<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>> OverweightTypedStorage
        {
            get
            {
                return _overweightTypedStorage;
            }
            set
            {
                _overweightTypedStorage = value;
            }
        }
        
        /// <summary>
        /// Connects to all storages and initializes the change subscription handling.
        /// </summary>
        public async Task InitializeAsync(Ajuna.ServiceLayer.Storage.IStorageDataProvider dataProvider)
        {
            await ConfigurationTypedStorage.InitializeAsync("DmpQueue", "Configuration");
            await PageIndexTypedStorage.InitializeAsync("DmpQueue", "PageIndex");
            await PagesTypedStorage.InitializeAsync("DmpQueue", "Pages");
            await OverweightTypedStorage.InitializeAsync("DmpQueue", "Overweight");
        }
        
        /// <summary>
        /// Implements any storage change for DmpQueue.Configuration
        /// </summary>
        [StorageChange("DmpQueue", "Configuration")]
        public void OnUpdateConfiguration(string data)
        {
            ConfigurationTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> Configuration
        ///  The configuration.
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.ConfigData GetConfiguration()
        {
            return ConfigurationTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for DmpQueue.PageIndex
        /// </summary>
        [StorageChange("DmpQueue", "PageIndex")]
        public void OnUpdatePageIndex(string data)
        {
            PageIndexTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> PageIndex
        ///  The page index.
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_pallet_dmp_queue.PageIndexData GetPageIndex()
        {
            return PageIndexTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for DmpQueue.Pages
        /// </summary>
        [StorageChange("DmpQueue", "Pages")]
        public void OnUpdatePages(string key, string data)
        {
            PagesTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> Pages
        ///  The queue pages.
        /// </summary>
        public Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>> GetPages(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (PagesTypedStorage.Dictionary.TryGetValue(key, out Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>>> result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
        
        /// <summary>
        /// Implements any storage change for DmpQueue.Overweight
        /// </summary>
        [StorageChange("DmpQueue", "Overweight")]
        public void OnUpdateOverweight(string key, string data)
        {
            OverweightTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> Overweight
        ///  The overweight messages.
        /// </summary>
        public Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>> GetOverweight(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (OverweightTypedStorage.Dictionary.TryGetValue(key, out Ajuna.NetApi.Model.Types.Base.BaseTuple<Ajuna.NetApi.Model.Types.Primitive.U32, Ajuna.NetApi.Model.Types.Base.BaseVec<Ajuna.NetApi.Model.Types.Primitive.U8>> result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
    }
}
