//------------------------------------------------------------------------------
// <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_awesome_avatars.types.config
{
    
    
    /// <summary>
    /// >> 115 - Composite[pallet_ajuna_awesome_avatars.types.config.TradeConfig]
    /// </summary>
    [AjunaNodeType(TypeDefEnum.Composite)]
    public sealed class TradeConfig : BaseType
    {
        
        /// <summary>
        /// >> open
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.Bool _open;
        
        /// <summary>
        /// >> min_fee
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U128 _minFee;
        
        /// <summary>
        /// >> percent_fee
        /// </summary>
        private Ajuna.NetApi.Model.Types.Primitive.U8 _percentFee;
        
        public Ajuna.NetApi.Model.Types.Primitive.Bool Open
        {
            get
            {
                return this._open;
            }
            set
            {
                this._open = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Primitive.U128 MinFee
        {
            get
            {
                return this._minFee;
            }
            set
            {
                this._minFee = value;
            }
        }
        
        public Ajuna.NetApi.Model.Types.Primitive.U8 PercentFee
        {
            get
            {
                return this._percentFee;
            }
            set
            {
                this._percentFee = value;
            }
        }
        
        public override string TypeName()
        {
            return "TradeConfig";
        }
        
        public override byte[] Encode()
        {
            var result = new List<byte>();
            result.AddRange(Open.Encode());
            result.AddRange(MinFee.Encode());
            result.AddRange(PercentFee.Encode());
            return result.ToArray();
        }
        
        public override void Decode(byte[] byteArray, ref int p)
        {
            var start = p;
            Open = new Ajuna.NetApi.Model.Types.Primitive.Bool();
            Open.Decode(byteArray, ref p);
            MinFee = new Ajuna.NetApi.Model.Types.Primitive.U128();
            MinFee.Decode(byteArray, ref p);
            PercentFee = new Ajuna.NetApi.Model.Types.Primitive.U8();
            PercentFee.Decode(byteArray, ref p);
            TypeSize = p - start;
        }
    }
}
