//------------------------------------------------------------------------------
// <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>
    /// IParachainInfoStorage interface definition.
    /// </summary>
    public interface IParachainInfoStorage : IStorage
    {
        
        /// <summary>
        /// >> ParachainId
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_parachain.primitives.Id GetParachainId();
    }
    
    /// <summary>
    /// ParachainInfoStorage class definition.
    /// </summary>
    public sealed class ParachainInfoStorage : IParachainInfoStorage
    {
        
        /// <summary>
        /// _parachainIdTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_parachain.primitives.Id> _parachainIdTypedStorage;
        
        /// <summary>
        /// ParachainInfoStorage constructor.
        /// </summary>
        public ParachainInfoStorage(IStorageDataProvider storageDataProvider, List<IStorageChangeDelegate> storageChangeDelegates)
        {
            this.ParachainIdTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_parachain.primitives.Id>("ParachainInfo.ParachainId", storageDataProvider, storageChangeDelegates);
        }
        
        /// <summary>
        /// _parachainIdTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_parachain.primitives.Id> ParachainIdTypedStorage
        {
            get
            {
                return _parachainIdTypedStorage;
            }
            set
            {
                _parachainIdTypedStorage = value;
            }
        }
        
        /// <summary>
        /// Connects to all storages and initializes the change subscription handling.
        /// </summary>
        public async Task InitializeAsync(Ajuna.ServiceLayer.Storage.IStorageDataProvider dataProvider)
        {
            await ParachainIdTypedStorage.InitializeAsync("ParachainInfo", "ParachainId");
        }
        
        /// <summary>
        /// Implements any storage change for ParachainInfo.ParachainId
        /// </summary>
        [StorageChange("ParachainInfo", "ParachainId")]
        public void OnUpdateParachainId(string data)
        {
            ParachainIdTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> ParachainId
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_parachain.primitives.Id GetParachainId()
        {
            return ParachainIdTypedStorage.Get();
        }
    }
}
