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

namespace Serial
{

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

public enum BuildingType : sbyte
{
 Housing = 0,
 Market = 1,
 Emergency = 2,
 Business = 3,
 Education = 4,
};

public struct Loc : IFlatbufferObject
{
  private Struct __p;
  public ByteBuffer ByteBuffer { get { return __p.bb; } }
  public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
  public Loc __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

  public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } }
  public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } }
  public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } }

  public static Offset<Loc> CreateLoc(FlatBufferBuilder builder, float X, float Y, float Z) {
    builder.Prep(4, 12);
    builder.PutFloat(Z);
    builder.PutFloat(Y);
    builder.PutFloat(X);
    return new Offset<Loc>(builder.Offset);
  }
};

public struct Building : IFlatbufferObject
{
  private Table __p;
  public ByteBuffer ByteBuffer { get { return __p.bb; } }
  public static Building GetRootAsBuilding(ByteBuffer _bb) { return GetRootAsBuilding(_bb, new Building()); }
  public static Building GetRootAsBuilding(ByteBuffer _bb, Building 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 Building __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

  public Loc? Pos { get { int o = __p.__offset(4); return o != 0 ? (Loc?)(new Loc()).__assign(o + __p.bb_pos, __p.bb) : null; } }
  public string Name { get { int o = __p.__offset(6); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
  public Span<byte> GetNameBytes() { return __p.__vector_as_span(6); }
#else
  public ArraySegment<byte>? GetNameBytes() { return __p.__vector_as_arraysegment(6); }
#endif
  public byte[] GetNameArray() { return __p.__vector_as_array<byte>(6); }
  public BuildingType Btype { get { int o = __p.__offset(8); return o != 0 ? (BuildingType)__p.bb.GetSbyte(o + __p.bb_pos) : BuildingType.Housing; } }

  public static void StartBuilding(FlatBufferBuilder builder) { builder.StartObject(3); }
  public static void AddPos(FlatBufferBuilder builder, Offset<Loc> posOffset) { builder.AddStruct(0, posOffset.Value, 0); }
  public static void AddName(FlatBufferBuilder builder, StringOffset nameOffset) { builder.AddOffset(1, nameOffset.Value, 0); }
  public static void AddBtype(FlatBufferBuilder builder, BuildingType btype) { builder.AddSbyte(2, (sbyte)btype, 0); }
  public static Offset<Building> EndBuilding(FlatBufferBuilder builder) {
    int o = builder.EndObject();
    return new Offset<Building>(o);
  }
  public static void FinishBuildingBuffer(FlatBufferBuilder builder, Offset<Building> offset) { builder.Finish(offset.Value); }
  public static void FinishSizePrefixedBuildingBuffer(FlatBufferBuilder builder, Offset<Building> offset) { builder.FinishSizePrefixed(offset.Value); }
};


}
