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

namespace Serial
{

using global::System;
using global::FlatBuffers;

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

  public string TownName { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetTownNameBytes() { return __p.__vector_as_span(4); }
#else
  public ArraySegment<byte>? GetTownNameBytes() { return __p.__vector_as_arraysegment(4); }
#endif
  public byte[] GetTownNameArray() { return __p.__vector_as_array<byte>(4); }
  public string Buildings(int j) { int o = __p.__offset(6); return o != 0 ? __p.__string(__p.__vector(o) + j * 4) : null; }
  public int BuildingsLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } }

  public static Offset<SaveState> CreateSaveState(FlatBufferBuilder builder,
      StringOffset townNameOffset = default(StringOffset),
      VectorOffset buildingsOffset = default(VectorOffset)) {
    builder.StartObject(2);
    SaveState.AddBuildings(builder, buildingsOffset);
    SaveState.AddTownName(builder, townNameOffset);
    return SaveState.EndSaveState(builder);
  }

  public static void StartSaveState(FlatBufferBuilder builder) { builder.StartObject(2); }
  public static void AddTownName(FlatBufferBuilder builder, StringOffset townNameOffset) { builder.AddOffset(0, townNameOffset.Value, 0); }
  public static void AddBuildings(FlatBufferBuilder builder, VectorOffset buildingsOffset) { builder.AddOffset(1, buildingsOffset.Value, 0); }
  public static VectorOffset CreateBuildingsVector(FlatBufferBuilder builder, StringOffset[] 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 CreateBuildingsVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
  public static void StartBuildingsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
  public static Offset<SaveState> EndSaveState(FlatBufferBuilder builder) {
    int o = builder.EndObject();
    return new Offset<SaveState>(o);
  }
  public static void FinishSaveStateBuffer(FlatBufferBuilder builder, Offset<SaveState> offset) { builder.Finish(offset.Value); }
  public static void FinishSizePrefixedSaveStateBuffer(FlatBufferBuilder builder, Offset<SaveState> offset) { builder.FinishSizePrefixed(offset.Value); }
};


}
