// <auto-generated>
//  automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>

namespace NymaTypes
{

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;

public struct Setting : IFlatbufferObject
{
  private Table __p;
  public ByteBuffer ByteBuffer { get { return __p.bb; } }
  public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_1_12_0(); }
  public static Setting GetRootAsSetting(ByteBuffer _bb) { return GetRootAsSetting(_bb, new Setting()); }
  public static Setting GetRootAsSetting(ByteBuffer _bb, Setting obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
  public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
  public Setting __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

  public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetNameBytes() { return __p.__vector_as_span<byte>(4, 1); }
#else
  public ArraySegment<byte>? GetNameBytes() { return __p.__vector_as_arraysegment(4); }
#endif
  public byte[] GetNameArray() { return __p.__vector_as_array<byte>(4); }
  public string Description { get { int o = __p.__offset(6); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetDescriptionBytes() { return __p.__vector_as_span<byte>(6, 1); }
#else
  public ArraySegment<byte>? GetDescriptionBytes() { return __p.__vector_as_arraysegment(6); }
#endif
  public byte[] GetDescriptionArray() { return __p.__vector_as_array<byte>(6); }
  public string SettingsKey { get { int o = __p.__offset(8); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetSettingsKeyBytes() { return __p.__vector_as_span<byte>(8, 1); }
#else
  public ArraySegment<byte>? GetSettingsKeyBytes() { return __p.__vector_as_arraysegment(8); }
#endif
  public byte[] GetSettingsKeyArray() { return __p.__vector_as_array<byte>(8); }
  public string DefaultValue { get { int o = __p.__offset(10); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetDefaultValueBytes() { return __p.__vector_as_span<byte>(10, 1); }
#else
  public ArraySegment<byte>? GetDefaultValueBytes() { return __p.__vector_as_arraysegment(10); }
#endif
  public byte[] GetDefaultValueArray() { return __p.__vector_as_array<byte>(10); }
  public string Min { get { int o = __p.__offset(12); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetMinBytes() { return __p.__vector_as_span<byte>(12, 1); }
#else
  public ArraySegment<byte>? GetMinBytes() { return __p.__vector_as_arraysegment(12); }
#endif
  public byte[] GetMinArray() { return __p.__vector_as_array<byte>(12); }
  public string Max { get { int o = __p.__offset(14); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetMaxBytes() { return __p.__vector_as_span<byte>(14, 1); }
#else
  public ArraySegment<byte>? GetMaxBytes() { return __p.__vector_as_arraysegment(14); }
#endif
  public byte[] GetMaxArray() { return __p.__vector_as_array<byte>(14); }
  public NymaTypes.SettingsFlags Flags { get { int o = __p.__offset(16); return o != 0 ? (NymaTypes.SettingsFlags)__p.bb.GetUint(o + __p.bb_pos) : 0; } }
  public NymaTypes.SettingType Type { get { int o = __p.__offset(18); return o != 0 ? (NymaTypes.SettingType)__p.bb.GetInt(o + __p.bb_pos) : NymaTypes.SettingType.Int; } }
  public NymaTypes.EnumValue? SettingEnums(int j) { int o = __p.__offset(20); return o != 0 ? (NymaTypes.EnumValue?)(new NymaTypes.EnumValue()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
  public int SettingEnumsLength { get { int o = __p.__offset(20); return o != 0 ? __p.__vector_len(o) : 0; } }

  public static Offset<NymaTypes.Setting> CreateSetting(FlatBufferBuilder builder,
      StringOffset NameOffset = default(StringOffset),
      StringOffset DescriptionOffset = default(StringOffset),
      StringOffset SettingsKeyOffset = default(StringOffset),
      StringOffset DefaultValueOffset = default(StringOffset),
      StringOffset MinOffset = default(StringOffset),
      StringOffset MaxOffset = default(StringOffset),
      NymaTypes.SettingsFlags Flags = 0,
      NymaTypes.SettingType Type = NymaTypes.SettingType.Int,
      VectorOffset SettingEnumsOffset = default(VectorOffset)) {
    builder.StartTable(9);
    Setting.AddSettingEnums(builder, SettingEnumsOffset);
    Setting.AddType(builder, Type);
    Setting.AddFlags(builder, Flags);
    Setting.AddMax(builder, MaxOffset);
    Setting.AddMin(builder, MinOffset);
    Setting.AddDefaultValue(builder, DefaultValueOffset);
    Setting.AddSettingsKey(builder, SettingsKeyOffset);
    Setting.AddDescription(builder, DescriptionOffset);
    Setting.AddName(builder, NameOffset);
    return Setting.EndSetting(builder);
  }

  public static void StartSetting(FlatBufferBuilder builder) { builder.StartTable(9); }
  public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); }
  public static void AddDescription(FlatBufferBuilder builder, StringOffset DescriptionOffset) { builder.AddOffset(1, DescriptionOffset.Value, 0); }
  public static void AddSettingsKey(FlatBufferBuilder builder, StringOffset SettingsKeyOffset) { builder.AddOffset(2, SettingsKeyOffset.Value, 0); }
  public static void AddDefaultValue(FlatBufferBuilder builder, StringOffset DefaultValueOffset) { builder.AddOffset(3, DefaultValueOffset.Value, 0); }
  public static void AddMin(FlatBufferBuilder builder, StringOffset MinOffset) { builder.AddOffset(4, MinOffset.Value, 0); }
  public static void AddMax(FlatBufferBuilder builder, StringOffset MaxOffset) { builder.AddOffset(5, MaxOffset.Value, 0); }
  public static void AddFlags(FlatBufferBuilder builder, NymaTypes.SettingsFlags Flags) { builder.AddUint(6, (uint)Flags, 0); }
  public static void AddType(FlatBufferBuilder builder, NymaTypes.SettingType Type) { builder.AddInt(7, (int)Type, 0); }
  public static void AddSettingEnums(FlatBufferBuilder builder, VectorOffset SettingEnumsOffset) { builder.AddOffset(8, SettingEnumsOffset.Value, 0); }
  public static VectorOffset CreateSettingEnumsVector(FlatBufferBuilder builder, Offset<NymaTypes.EnumValue>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
  public static VectorOffset CreateSettingEnumsVectorBlock(FlatBufferBuilder builder, Offset<NymaTypes.EnumValue>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
  public static void StartSettingEnumsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
  public static Offset<NymaTypes.Setting> EndSetting(FlatBufferBuilder builder) {
    int o = builder.EndTable();
    return new Offset<NymaTypes.Setting>(o);
  }
  public SettingT UnPack() {
    var _o = new SettingT();
    this.UnPackTo(_o);
    return _o;
  }
  public void UnPackTo(SettingT _o) {
    _o.Name = this.Name;
    _o.Description = this.Description;
    _o.SettingsKey = this.SettingsKey;
    _o.DefaultValue = this.DefaultValue;
    _o.Min = this.Min;
    _o.Max = this.Max;
    _o.Flags = this.Flags;
    _o.Type = this.Type;
    _o.SettingEnums = new List<NymaTypes.EnumValueT>();
    for (var _j = 0; _j < this.SettingEnumsLength; ++_j) {_o.SettingEnums.Add(this.SettingEnums(_j).HasValue ? this.SettingEnums(_j).Value.UnPack() : null);}
  }
  public static Offset<NymaTypes.Setting> Pack(FlatBufferBuilder builder, SettingT _o) {
    if (_o == null) return default(Offset<NymaTypes.Setting>);
    var _Name = _o.Name == null ? default(StringOffset) : builder.CreateString(_o.Name);
    var _Description = _o.Description == null ? default(StringOffset) : builder.CreateString(_o.Description);
    var _SettingsKey = _o.SettingsKey == null ? default(StringOffset) : builder.CreateString(_o.SettingsKey);
    var _DefaultValue = _o.DefaultValue == null ? default(StringOffset) : builder.CreateString(_o.DefaultValue);
    var _Min = _o.Min == null ? default(StringOffset) : builder.CreateString(_o.Min);
    var _Max = _o.Max == null ? default(StringOffset) : builder.CreateString(_o.Max);
    var _SettingEnums = default(VectorOffset);
    if (_o.SettingEnums != null) {
      var __SettingEnums = new Offset<NymaTypes.EnumValue>[_o.SettingEnums.Count];
      for (var _j = 0; _j < __SettingEnums.Length; ++_j) { __SettingEnums[_j] = NymaTypes.EnumValue.Pack(builder, _o.SettingEnums[_j]); }
      _SettingEnums = CreateSettingEnumsVector(builder, __SettingEnums);
    }
    return CreateSetting(
      builder,
      _Name,
      _Description,
      _SettingsKey,
      _DefaultValue,
      _Min,
      _Max,
      _o.Flags,
      _o.Type,
      _SettingEnums);
  }
};

public class SettingT
{
  public string Name { get; set; }
  public string Description { get; set; }
  public string SettingsKey { get; set; }
  public string DefaultValue { get; set; }
  public string Min { get; set; }
  public string Max { get; set; }
  public NymaTypes.SettingsFlags Flags { get; set; }
  public NymaTypes.SettingType Type { get; set; }
  public List<NymaTypes.EnumValueT> SettingEnums { get; set; }

  public SettingT() {
    this.Name = null;
    this.Description = null;
    this.SettingsKey = null;
    this.DefaultValue = null;
    this.Min = null;
    this.Max = null;
    this.Flags = 0;
    this.Type = NymaTypes.SettingType.Int;
    this.SettingEnums = null;
  }
}


}
