//------------------------------------------------------------------------------
// <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.pallet_ajuna_nft_staking.contracts
{
    
    
    /// <summary>
    /// >> 311 - Composite[pallet_ajuna_nft_staking.contracts.StakingContract]
    /// </summary>
    [AjunaNodeType(TypeDefEnum.Composite)]
    public sealed class StakingContract : BaseType
    {
        
        /// <summary>
        /// >> staking_reward
        /// </summary>
        private Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.EnumStakingReward _stakingReward;
        
        /// <summary>
        /// >> contract_clauses
        /// </summary>
        private Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT11 _contractClauses;
        
        /// <summary>
        /// >> contract_block_duration
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U32 _contractBlockDuration;
        
        public Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.EnumStakingReward StakingReward
        {
            get
            {
                return this._stakingReward;
            }
            set
            {
                this._stakingReward = value;
            }
        }
        
        public Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT11 ContractClauses
        {
            get
            {
                return this._contractClauses;
            }
            set
            {
                this._contractClauses = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Primitive.U32 ContractBlockDuration
        {
            get
            {
                return this._contractBlockDuration;
            }
            set
            {
                this._contractBlockDuration = value;
            }
        }
        
        public override string TypeName()
        {
            return "StakingContract";
        }
        
        public override byte[] Encode()
        {
            var result = new List<byte>();
            result.AddRange(StakingReward.Encode());
            result.AddRange(ContractClauses.Encode());
            result.AddRange(ContractBlockDuration.Encode());
            return result.ToArray();
        }
        
        public override void Decode(byte[] byteArray, ref int p)
        {
            var start = p;
            StakingReward = new Bajun.Network.NET.NetApiExt.Generated.Model.pallet_ajuna_nft_staking.contracts.EnumStakingReward();
            StakingReward.Decode(byteArray, ref p);
            ContractClauses = new Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT11();
            ContractClauses.Decode(byteArray, ref p);
            ContractBlockDuration = new Ajuna.NetApi.Model.Types.Primitive.U32();
            ContractBlockDuration.Decode(byteArray, ref p);
            TypeSize = p - start;
        }
    }
}
