//------------------------------------------------------------------------------
// <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.Attributes;
using Ajuna.NetApi.Model.Types.Base;
using Ajuna.NetApi.Model.Types.Metadata.V14;
using System.Collections.Generic;


namespace Bajun.Network.NET.NetApiExt.Generated.Model.cumulus_primitives_parachain_inherent
{
    
    
    /// <summary>
    /// >> 173 - Composite[cumulus_primitives_parachain_inherent.ParachainInherentData]
    /// </summary>
    [AjunaNodeType(TypeDefEnum.Composite)]
    public sealed class ParachainInherentData : BaseType
    {
        
        /// <summary>
        /// >> validation_data
        /// </summary>
        private Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_primitives.v2.PersistedValidationData _validationData;
        
        /// <summary>
        /// >> relay_chain_state
        /// </summary>
        private Bajun.Network.NET.NetApiExt.Generated.Model.sp_trie.storage_proof.StorageProof _relayChainState;
        
        /// <summary>
        /// >> downward_messages
        /// </summary>
        private Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_core_primitives.InboundDownwardMessage> _downwardMessages;
        
        /// <summary>
        /// >> horizontal_messages
        /// </summary>
        private Bajun.Network.NET.NetApiExt.Generated.Types.Base.BTreeMapT2 _horizontalMessages;
        
        public Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_primitives.v2.PersistedValidationData ValidationData
        {
            get
            {
                return this._validationData;
            }
            set
            {
                this._validationData = value;
            }
        }
        
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_trie.storage_proof.StorageProof RelayChainState
        {
            get
            {
                return this._relayChainState;
            }
            set
            {
                this._relayChainState = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_core_primitives.InboundDownwardMessage> DownwardMessages
        {
            get
            {
                return this._downwardMessages;
            }
            set
            {
                this._downwardMessages = value;
            }
        }
        
        public Bajun.Network.NET.NetApiExt.Generated.Types.Base.BTreeMapT2 HorizontalMessages
        {
            get
            {
                return this._horizontalMessages;
            }
            set
            {
                this._horizontalMessages = value;
            }
        }
        
        public override string TypeName()
        {
            return "ParachainInherentData";
        }
        
        public override byte[] Encode()
        {
            var result = new List<byte>();
            result.AddRange(ValidationData.Encode());
            result.AddRange(RelayChainState.Encode());
            result.AddRange(DownwardMessages.Encode());
            result.AddRange(HorizontalMessages.Encode());
            return result.ToArray();
        }
        
        public override void Decode(byte[] byteArray, ref int p)
        {
            var start = p;
            ValidationData = new Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_primitives.v2.PersistedValidationData();
            ValidationData.Decode(byteArray, ref p);
            RelayChainState = new Bajun.Network.NET.NetApiExt.Generated.Model.sp_trie.storage_proof.StorageProof();
            RelayChainState.Decode(byteArray, ref p);
            DownwardMessages = new Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.polkadot_core_primitives.InboundDownwardMessage>();
            DownwardMessages.Decode(byteArray, ref p);
            HorizontalMessages = new Bajun.Network.NET.NetApiExt.Generated.Types.Base.BTreeMapT2();
            HorizontalMessages.Decode(byteArray, ref p);
            TypeSize = p - start;
        }
    }
}
