//------------------------------------------------------------------------------
// <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.orml_vesting
{
    
    
    /// <summary>
    /// >> 47 - Composite[orml_vesting.VestingSchedule]
    /// </summary>
    [AjunaNodeType(TypeDefEnum.Composite)]
    public sealed class VestingSchedule : BaseType
    {
        
        /// <summary>
        /// >> start
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U32 _start;
        
        /// <summary>
        /// >> period
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U32 _period;
        
        /// <summary>
        /// >> period_count
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U32 _periodCount;
        
        /// <summary>
        /// >> per_period
        /// </summary>
        private Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U128> _perPeriod;
        
        public Ajuna.NetApi.Model.Types.Primitive.U32 Start
        {
            get
            {
                return this._start;
            }
            set
            {
                this._start = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Primitive.U32 Period
        {
            get
            {
                return this._period;
            }
            set
            {
                this._period = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Primitive.U32 PeriodCount
        {
            get
            {
                return this._periodCount;
            }
            set
            {
                this._periodCount = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U128> PerPeriod
        {
            get
            {
                return this._perPeriod;
            }
            set
            {
                this._perPeriod = value;
            }
        }
        
        public override string TypeName()
        {
            return "VestingSchedule";
        }
        
        public override byte[] Encode()
        {
            var result = new List<byte>();
            result.AddRange(Start.Encode());
            result.AddRange(Period.Encode());
            result.AddRange(PeriodCount.Encode());
            result.AddRange(PerPeriod.Encode());
            return result.ToArray();
        }
        
        public override void Decode(byte[] byteArray, ref int p)
        {
            var start = p;
            Start = new Ajuna.NetApi.Model.Types.Primitive.U32();
            Start.Decode(byteArray, ref p);
            Period = new Ajuna.NetApi.Model.Types.Primitive.U32();
            Period.Decode(byteArray, ref p);
            PeriodCount = new Ajuna.NetApi.Model.Types.Primitive.U32();
            PeriodCount.Decode(byteArray, ref p);
            PerPeriod = new Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U128>();
            PerPeriod.Decode(byteArray, ref p);
            TypeSize = p - start;
        }
    }
}
