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

namespace Frontend
{

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

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

    public byte FromModuleId { get { int o = __p.__offset(4); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
    public byte ToModuleId { get { int o = __p.__offset(6); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
    public byte FromSocket { get { int o = __p.__offset(8); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
    public byte ToSocket { get { int o = __p.__offset(10); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
    public Orientation Orientation { get { int o = __p.__offset(12); return o != 0 ? (Orientation)__p.bb.GetSbyte(o + __p.bb_pos) : Orientation.Deg0; } }

    public static Offset<Frontend.ModuleConnection> CreateModuleConnection(FlatBufferBuilder builder,
        byte from_module_id = 0,
        byte to_module_id = 0,
        byte from_socket = 0,
        byte to_socket = 0,
        Orientation orientation = Orientation.Deg0)
    {
      builder.StartTable(5);
      ModuleConnection.AddOrientation(builder, orientation);
      ModuleConnection.AddToSocket(builder, to_socket);
      ModuleConnection.AddFromSocket(builder, from_socket);
      ModuleConnection.AddToModuleId(builder, to_module_id);
      ModuleConnection.AddFromModuleId(builder, from_module_id);
      return ModuleConnection.EndModuleConnection(builder);
    }

    public static void StartModuleConnection(FlatBufferBuilder builder) { builder.StartTable(5); }
    public static void AddFromModuleId(FlatBufferBuilder builder, byte fromModuleId) { builder.AddByte(0, fromModuleId, 0); }
    public static void AddToModuleId(FlatBufferBuilder builder, byte toModuleId) { builder.AddByte(1, toModuleId, 0); }
    public static void AddFromSocket(FlatBufferBuilder builder, byte fromSocket) { builder.AddByte(2, fromSocket, 0); }
    public static void AddToSocket(FlatBufferBuilder builder, byte toSocket) { builder.AddByte(3, toSocket, 0); }
    public static void AddOrientation(FlatBufferBuilder builder, Orientation orientation) { builder.AddSbyte(4, (sbyte)orientation, 0); }
    public static Offset<Frontend.ModuleConnection> EndModuleConnection(FlatBufferBuilder builder)
    {
      int o = builder.EndTable();
      return new Offset<Frontend.ModuleConnection>(o);
    }
  }


  static public class ModuleConnectionVerify
  {
    static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
    {
      return verifier.VerifyTableStart(tablePos)
        && verifier.VerifyField(tablePos, 4 /*FromModuleId*/, 1 /*byte*/, 1, false)
        && verifier.VerifyField(tablePos, 6 /*ToModuleId*/, 1 /*byte*/, 1, false)
        && verifier.VerifyField(tablePos, 8 /*FromSocket*/, 1 /*byte*/, 1, false)
        && verifier.VerifyField(tablePos, 10 /*ToSocket*/, 1 /*byte*/, 1, false)
        && verifier.VerifyField(tablePos, 12 /*Orientation*/, 1 /*Orientation*/, 1, false)
        && verifier.VerifyTableEnd(tablePos);
    }
  }

}
