//------------------------------------------------------------------------------
// <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>
    /// INftStakeStorage interface definition.
    /// </summary>
    public interface INftStakeStorage : IStorage
    {
        
        /// <summary>
        /// >> Organizer
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetOrganizer();
        
        /// <summary>
        /// >> LockedState
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.pallet.EnumPalletLockedState GetLockedState();
        
        /// <summary>
        /// >> ActiveContracts
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract GetActiveContracts(string key);
        
        /// <summary>
        /// >> ContractOwners
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetContractOwners(string key);
        
        /// <summary>
        /// >> ContractDurations
        /// </summary>
        Ajuna.NetApi.Model.Types.Primitive.U32 GetContractDurations(string key);
        
        /// <summary>
        /// >> ContractStakedAssets
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12 GetContractStakedAssets(string key);
        
        /// <summary>
        /// >> TreasuryAccount
        /// </summary>
        Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetTreasuryAccount();
        
        /// <summary>
        /// >> ContractCollectionId
        /// </summary>
        Ajuna.NetApi.Model.Types.Primitive.U32 GetContractCollectionId();
        
        /// <summary>
        /// >> NextContractId
        /// </summary>
        Ajuna.NetApi.Model.Types.Primitive.U128 GetNextContractId();
    }
    
    /// <summary>
    /// NftStakeStorage class definition.
    /// </summary>
    public sealed class NftStakeStorage : INftStakeStorage
    {
        
        /// <summary>
        /// _organizerTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> _organizerTypedStorage;
        
        /// <summary>
        /// _lockedStateTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.pallet.EnumPalletLockedState> _lockedStateTypedStorage;
        
        /// <summary>
        /// _activeContractsTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract> _activeContractsTypedStorage;
        
        /// <summary>
        /// _contractOwnersTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> _contractOwnersTypedStorage;
        
        /// <summary>
        /// _contractDurationsTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Ajuna.NetApi.Model.Types.Primitive.U32> _contractDurationsTypedStorage;
        
        /// <summary>
        /// _contractStakedAssetsTypedStorage typed storage field
        /// </summary>
        private TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12> _contractStakedAssetsTypedStorage;
        
        /// <summary>
        /// _treasuryAccountTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> _treasuryAccountTypedStorage;
        
        /// <summary>
        /// _contractCollectionIdTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U32> _contractCollectionIdTypedStorage;
        
        /// <summary>
        /// _nextContractIdTypedStorage typed storage field
        /// </summary>
        private TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U128> _nextContractIdTypedStorage;
        
        /// <summary>
        /// NftStakeStorage constructor.
        /// </summary>
        public NftStakeStorage(IStorageDataProvider storageDataProvider, List<IStorageChangeDelegate> storageChangeDelegates)
        {
            this.OrganizerTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>("NftStake.Organizer", storageDataProvider, storageChangeDelegates);
            this.LockedStateTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.pallet.EnumPalletLockedState>("NftStake.LockedState", storageDataProvider, storageChangeDelegates);
            this.ActiveContractsTypedStorage = new TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract>("NftStake.ActiveContracts", storageDataProvider, storageChangeDelegates);
            this.ContractOwnersTypedStorage = new TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>("NftStake.ContractOwners", storageDataProvider, storageChangeDelegates);
            this.ContractDurationsTypedStorage = new TypedMapStorage<Ajuna.NetApi.Model.Types.Primitive.U32>("NftStake.ContractDurations", storageDataProvider, storageChangeDelegates);
            this.ContractStakedAssetsTypedStorage = new TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12>("NftStake.ContractStakedAssets", storageDataProvider, storageChangeDelegates);
            this.TreasuryAccountTypedStorage = new TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>("NftStake.TreasuryAccount", storageDataProvider, storageChangeDelegates);
            this.ContractCollectionIdTypedStorage = new TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U32>("NftStake.ContractCollectionId", storageDataProvider, storageChangeDelegates);
            this.NextContractIdTypedStorage = new TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U128>("NftStake.NextContractId", storageDataProvider, storageChangeDelegates);
        }
        
        /// <summary>
        /// _organizerTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> OrganizerTypedStorage
        {
            get
            {
                return _organizerTypedStorage;
            }
            set
            {
                _organizerTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _lockedStateTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.pallet.EnumPalletLockedState> LockedStateTypedStorage
        {
            get
            {
                return _lockedStateTypedStorage;
            }
            set
            {
                _lockedStateTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _activeContractsTypedStorage property
        /// </summary>
        public TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract> ActiveContractsTypedStorage
        {
            get
            {
                return _activeContractsTypedStorage;
            }
            set
            {
                _activeContractsTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _contractOwnersTypedStorage property
        /// </summary>
        public TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> ContractOwnersTypedStorage
        {
            get
            {
                return _contractOwnersTypedStorage;
            }
            set
            {
                _contractOwnersTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _contractDurationsTypedStorage property
        /// </summary>
        public TypedMapStorage<Ajuna.NetApi.Model.Types.Primitive.U32> ContractDurationsTypedStorage
        {
            get
            {
                return _contractDurationsTypedStorage;
            }
            set
            {
                _contractDurationsTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _contractStakedAssetsTypedStorage property
        /// </summary>
        public TypedMapStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12> ContractStakedAssetsTypedStorage
        {
            get
            {
                return _contractStakedAssetsTypedStorage;
            }
            set
            {
                _contractStakedAssetsTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _treasuryAccountTypedStorage property
        /// </summary>
        public TypedStorage<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> TreasuryAccountTypedStorage
        {
            get
            {
                return _treasuryAccountTypedStorage;
            }
            set
            {
                _treasuryAccountTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _contractCollectionIdTypedStorage property
        /// </summary>
        public TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U32> ContractCollectionIdTypedStorage
        {
            get
            {
                return _contractCollectionIdTypedStorage;
            }
            set
            {
                _contractCollectionIdTypedStorage = value;
            }
        }
        
        /// <summary>
        /// _nextContractIdTypedStorage property
        /// </summary>
        public TypedStorage<Ajuna.NetApi.Model.Types.Primitive.U128> NextContractIdTypedStorage
        {
            get
            {
                return _nextContractIdTypedStorage;
            }
            set
            {
                _nextContractIdTypedStorage = value;
            }
        }
        
        /// <summary>
        /// Connects to all storages and initializes the change subscription handling.
        /// </summary>
        public async Task InitializeAsync(Ajuna.ServiceLayer.Storage.IStorageDataProvider dataProvider)
        {
            await OrganizerTypedStorage.InitializeAsync("NftStake", "Organizer");
            await LockedStateTypedStorage.InitializeAsync("NftStake", "LockedState");
            await ActiveContractsTypedStorage.InitializeAsync("NftStake", "ActiveContracts");
            await ContractOwnersTypedStorage.InitializeAsync("NftStake", "ContractOwners");
            await ContractDurationsTypedStorage.InitializeAsync("NftStake", "ContractDurations");
            await ContractStakedAssetsTypedStorage.InitializeAsync("NftStake", "ContractStakedAssets");
            await TreasuryAccountTypedStorage.InitializeAsync("NftStake", "TreasuryAccount");
            await ContractCollectionIdTypedStorage.InitializeAsync("NftStake", "ContractCollectionId");
            await NextContractIdTypedStorage.InitializeAsync("NftStake", "NextContractId");
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.Organizer
        /// </summary>
        [StorageChange("NftStake", "Organizer")]
        public void OnUpdateOrganizer(string data)
        {
            OrganizerTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> Organizer
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetOrganizer()
        {
            return OrganizerTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.LockedState
        /// </summary>
        [StorageChange("NftStake", "LockedState")]
        public void OnUpdateLockedState(string data)
        {
            LockedStateTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> LockedState
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.pallet.EnumPalletLockedState GetLockedState()
        {
            return LockedStateTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.ActiveContracts
        /// </summary>
        [StorageChange("NftStake", "ActiveContracts")]
        public void OnUpdateActiveContracts(string key, string data)
        {
            ActiveContractsTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> ActiveContracts
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract GetActiveContracts(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (ActiveContractsTypedStorage.Dictionary.TryGetValue(key, out Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.StakingContract result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.ContractOwners
        /// </summary>
        [StorageChange("NftStake", "ContractOwners")]
        public void OnUpdateContractOwners(string key, string data)
        {
            ContractOwnersTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> ContractOwners
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetContractOwners(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (ContractOwnersTypedStorage.Dictionary.TryGetValue(key, out Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.ContractDurations
        /// </summary>
        [StorageChange("NftStake", "ContractDurations")]
        public void OnUpdateContractDurations(string key, string data)
        {
            ContractDurationsTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> ContractDurations
        /// </summary>
        public Ajuna.NetApi.Model.Types.Primitive.U32 GetContractDurations(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (ContractDurationsTypedStorage.Dictionary.TryGetValue(key, out Ajuna.NetApi.Model.Types.Primitive.U32 result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.ContractStakedAssets
        /// </summary>
        [StorageChange("NftStake", "ContractStakedAssets")]
        public void OnUpdateContractStakedAssets(string key, string data)
        {
            ContractStakedAssetsTypedStorage.Update(key, data);
        }
        
        /// <summary>
        /// >> ContractStakedAssets
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12 GetContractStakedAssets(string key)
        {
            if ((key == null))
            {
                return null;
            }
            if (ContractStakedAssetsTypedStorage.Dictionary.TryGetValue(key, out Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT12 result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.TreasuryAccount
        /// </summary>
        [StorageChange("NftStake", "TreasuryAccount")]
        public void OnUpdateTreasuryAccount(string data)
        {
            TreasuryAccountTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> TreasuryAccount
        /// </summary>
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32 GetTreasuryAccount()
        {
            return TreasuryAccountTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.ContractCollectionId
        /// </summary>
        [StorageChange("NftStake", "ContractCollectionId")]
        public void OnUpdateContractCollectionId(string data)
        {
            ContractCollectionIdTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> ContractCollectionId
        /// </summary>
        public Ajuna.NetApi.Model.Types.Primitive.U32 GetContractCollectionId()
        {
            return ContractCollectionIdTypedStorage.Get();
        }
        
        /// <summary>
        /// Implements any storage change for NftStake.NextContractId
        /// </summary>
        [StorageChange("NftStake", "NextContractId")]
        public void OnUpdateNextContractId(string data)
        {
            NextContractIdTypedStorage.Update(data);
        }
        
        /// <summary>
        /// >> NextContractId
        /// </summary>
        public Ajuna.NetApi.Model.Types.Primitive.U128 GetNextContractId()
        {
            return NextContractIdTypedStorage.Get();
        }
    }
}
