#------------------------------------------------------------------------------
# Automatically generated by the Fast Binary Encoding compiler, do not modify!
# https://github.com/chronoxor/FastBinaryEncoding
# Source: test.fbe
# FBE version: 1.15.0.0
#------------------------------------------------------------------------------

# rubocop:disable Lint/MissingCopEnableDirective
# rubocop:disable Lint/UnneededCopDisableDirective
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/ClassLength
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/LineLength
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity

require 'base64'
require 'bigdecimal'
require 'json'
require 'set'
require 'uuidtools'

require_relative 'fbe'
require_relative 'proto'

module Test

  module EnumSimple
    class Enum
      include FBE::Enum

      define :ENUM_VALUE_0, 0 + 0
      define :ENUM_VALUE_1, 1 + 0
      define :ENUM_VALUE_2, 1 + 1
      define :ENUM_VALUE_3, 3 + 0
      define :ENUM_VALUE_4, 0x4 + 0
      define :ENUM_VALUE_5, Enum.value(:ENUM_VALUE_3)

      def initialize(value = 0)
        @value = value.is_a?(Enum) ? value.value : value
      end

      # Enum compare operators
      def ==(value) @value == value.value end
      def !=(value) @value != value.value end

      # Enum equals
      def eql?(other)
        self == other
      end

      # Enum hash code
      def hash
        @value.hash
      end

      # Get enum integer value
      def to_i
        @value
      end

      # Get enum string value
      def to_s
        if @value == Enum.ENUM_VALUE_0
          return 'ENUM_VALUE_0'
        end
        if @value == Enum.ENUM_VALUE_1
          return 'ENUM_VALUE_1'
        end
        if @value == Enum.ENUM_VALUE_2
          return 'ENUM_VALUE_2'
        end
        if @value == Enum.ENUM_VALUE_3
          return 'ENUM_VALUE_3'
        end
        if @value == Enum.ENUM_VALUE_4
          return 'ENUM_VALUE_4'
        end
        if @value == Enum.ENUM_VALUE_5
          return 'ENUM_VALUE_5'
        end
        '<unknown>'
      end

      # Get enum JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
      attr_accessor :ENUM_VALUE_0
      attr_accessor :ENUM_VALUE_1
      attr_accessor :ENUM_VALUE_2
      attr_accessor :ENUM_VALUE_3
      attr_accessor :ENUM_VALUE_4
      attr_accessor :ENUM_VALUE_5
    end

    self.ENUM_VALUE_0 = Enum.new(Enum.ENUM_VALUE_0)
    self.ENUM_VALUE_1 = Enum.new(Enum.ENUM_VALUE_1)
    self.ENUM_VALUE_2 = Enum.new(Enum.ENUM_VALUE_2)
    self.ENUM_VALUE_3 = Enum.new(Enum.ENUM_VALUE_3)
    self.ENUM_VALUE_4 = Enum.new(Enum.ENUM_VALUE_4)
    self.ENUM_VALUE_5 = Enum.new(Enum.ENUM_VALUE_5)

    def self.new(value = 0)
      Enum.new(value)
    end

    # Get enum value from JSON
    def self.__from_json_map__(json)
      Enum.new(json)
    end
  end

  EnumSimple.freeze

  # Fast Binary Encoding EnumSimple field model
  class FieldModelEnumSimple < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the value
    def get(defaults = EnumSimple.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      EnumSimple.new(read_int32(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_int32(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding EnumSimple final model
  class FinalModelEnumSimple < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      4
    end

    # Is the enum value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [EnumSimple.new, 0]
      end

      [EnumSimple.new(read_int32(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_int32(fbe_offset, value.value)
      fbe_size
    end
  end

  module EnumTyped
    class Enum
      include FBE::Enum

      define :ENUM_VALUE_0, 0 + 0
      define :ENUM_VALUE_1, '1'.ord + 0
      define :ENUM_VALUE_2, '1'.ord + 1
      define :ENUM_VALUE_3, '3'.ord + 0
      define :ENUM_VALUE_4, '3'.ord + 1
      define :ENUM_VALUE_5, Enum.value(:ENUM_VALUE_3)

      def initialize(value = 0)
        @value = value.is_a?(Enum) ? value.value : value
      end

      # Enum compare operators
      def ==(value) @value == value.value end
      def !=(value) @value != value.value end

      # Enum equals
      def eql?(other)
        self == other
      end

      # Enum hash code
      def hash
        @value.hash
      end

      # Get enum integer value
      def to_i
        @value
      end

      # Get enum string value
      def to_s
        if @value == Enum.ENUM_VALUE_0
          return 'ENUM_VALUE_0'
        end
        if @value == Enum.ENUM_VALUE_1
          return 'ENUM_VALUE_1'
        end
        if @value == Enum.ENUM_VALUE_2
          return 'ENUM_VALUE_2'
        end
        if @value == Enum.ENUM_VALUE_3
          return 'ENUM_VALUE_3'
        end
        if @value == Enum.ENUM_VALUE_4
          return 'ENUM_VALUE_4'
        end
        if @value == Enum.ENUM_VALUE_5
          return 'ENUM_VALUE_5'
        end
        '<unknown>'
      end

      # Get enum JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
      attr_accessor :ENUM_VALUE_0
      attr_accessor :ENUM_VALUE_1
      attr_accessor :ENUM_VALUE_2
      attr_accessor :ENUM_VALUE_3
      attr_accessor :ENUM_VALUE_4
      attr_accessor :ENUM_VALUE_5
    end

    self.ENUM_VALUE_0 = Enum.new(Enum.ENUM_VALUE_0)
    self.ENUM_VALUE_1 = Enum.new(Enum.ENUM_VALUE_1)
    self.ENUM_VALUE_2 = Enum.new(Enum.ENUM_VALUE_2)
    self.ENUM_VALUE_3 = Enum.new(Enum.ENUM_VALUE_3)
    self.ENUM_VALUE_4 = Enum.new(Enum.ENUM_VALUE_4)
    self.ENUM_VALUE_5 = Enum.new(Enum.ENUM_VALUE_5)

    def self.new(value = 0)
      Enum.new(value)
    end

    # Get enum value from JSON
    def self.__from_json_map__(json)
      Enum.new(json)
    end
  end

  EnumTyped.freeze

  # Fast Binary Encoding EnumTyped field model
  class FieldModelEnumTyped < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      1
    end

    # Get the value
    def get(defaults = EnumTyped.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      EnumTyped.new(read_uint8(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_uint8(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding EnumTyped final model
  class FinalModelEnumTyped < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      1
    end

    # Is the enum value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [EnumTyped.new, 0]
      end

      [EnumTyped.new(read_uint8(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_uint8(fbe_offset, value.value)
      fbe_size
    end
  end

  module EnumEmpty
    class Enum
      include FBE::Enum
      def initialize(value = 0)
        @value = value.is_a?(Enum) ? value.value : value
      end

      # Enum compare operators
      def ==(value) @value == value.value end
      def !=(value) @value != value.value end

      # Enum equals
      def eql?(other)
        self == other
      end

      # Enum hash code
      def hash
        @value.hash
      end

      # Get enum integer value
      def to_i
        @value
      end

      # Get enum string value
      def to_s
        '<empty>'
      end

      # Get enum JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
    end

    def self.new(value = 0)
      Enum.new(value)
    end

    # Get enum value from JSON
    def self.__from_json_map__(json)
      Enum.new(json)
    end
  end

  EnumEmpty.freeze

  # Fast Binary Encoding EnumEmpty field model
  class FieldModelEnumEmpty < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the value
    def get(defaults = EnumEmpty.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      EnumEmpty.new(read_int32(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_int32(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding EnumEmpty final model
  class FinalModelEnumEmpty < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      4
    end

    # Is the enum value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [EnumEmpty.new, 0]
      end

      [EnumEmpty.new(read_int32(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_int32(fbe_offset, value.value)
      fbe_size
    end
  end

  module FlagsSimple
    class Flags
      include FBE::Flags

      define :FLAG_VALUE_0, 0x0
      define :FLAG_VALUE_1, 0x1
      define :FLAG_VALUE_2, 0x2
      define :FLAG_VALUE_3, 0x4
      define :FLAG_VALUE_4, Flags.value(:FLAG_VALUE_3)
      define :FLAG_VALUE_5, Flags.value(:FLAG_VALUE_1)|Flags.value(:FLAG_VALUE_3)

      def initialize(value = 0)
        @value = value.is_a?(Flags) ? value.value : value
      end

      # Flags compare operators
      def ==(flags) @value == flags.value end
      def !=(flags) @value != flags.value end

      # Flags bit operators
      def ~
        Flags.new(~@value)
      end
      def &(flags) Flags.new(@value & flags.value) end
      def |(flags) Flags.new(@value | flags.value) end
      def ^(flags) Flags.new(@value ^ flags.value) end

      # Flags equals
      def eql?(other)
        self == other
      end

      # Flags hash code
      def hash
        @value.hash
      end

      # Is flags set?
      def has_flags(flags)
        ((@value & flags.value) != 0) && ((@value & flags.value) == flags.value)
      end

      # Set flags
      def set_flags(flags)
        @value |= flags.value
        self
      end

      # Remove flags
      def remove_flags(flags)
        @value &= ~flags.value
        self
      end

      # Get flags integer value
      def to_i
        @value
      end

      # Get flags string value
      def to_s
        result = ''
        first = true
        if ((@value & Flags.FLAG_VALUE_0) != 0) && ((@value & Flags.FLAG_VALUE_0) == Flags.FLAG_VALUE_0)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_0'
        end
        if ((@value & Flags.FLAG_VALUE_1) != 0) && ((@value & Flags.FLAG_VALUE_1) == Flags.FLAG_VALUE_1)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_1'
        end
        if ((@value & Flags.FLAG_VALUE_2) != 0) && ((@value & Flags.FLAG_VALUE_2) == Flags.FLAG_VALUE_2)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_2'
        end
        if ((@value & Flags.FLAG_VALUE_3) != 0) && ((@value & Flags.FLAG_VALUE_3) == Flags.FLAG_VALUE_3)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_3'
        end
        if ((@value & Flags.FLAG_VALUE_4) != 0) && ((@value & Flags.FLAG_VALUE_4) == Flags.FLAG_VALUE_4)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_4'
        end
        if ((@value & Flags.FLAG_VALUE_5) != 0) && ((@value & Flags.FLAG_VALUE_5) == Flags.FLAG_VALUE_5)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_5'
        end
        result
      end

      # Get flags JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
      attr_accessor :FLAG_VALUE_0
      attr_accessor :FLAG_VALUE_1
      attr_accessor :FLAG_VALUE_2
      attr_accessor :FLAG_VALUE_3
      attr_accessor :FLAG_VALUE_4
      attr_accessor :FLAG_VALUE_5
    end

    self.FLAG_VALUE_0 = Flags.new(Flags.FLAG_VALUE_0)
    self.FLAG_VALUE_1 = Flags.new(Flags.FLAG_VALUE_1)
    self.FLAG_VALUE_2 = Flags.new(Flags.FLAG_VALUE_2)
    self.FLAG_VALUE_3 = Flags.new(Flags.FLAG_VALUE_3)
    self.FLAG_VALUE_4 = Flags.new(Flags.FLAG_VALUE_4)
    self.FLAG_VALUE_5 = Flags.new(Flags.FLAG_VALUE_5)

    def self.new(value = 0)
      Flags.new(value)
    end

    # Get flags value from JSON
    def self.__from_json_map__(json)
      Flags.new(json)
    end
  end

  FlagsSimple.freeze

  # Fast Binary Encoding FlagsSimple field model
  class FieldModelFlagsSimple < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the value
    def get(defaults = FlagsSimple.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      FlagsSimple.new(read_int32(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_int32(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding FlagsSimple final model
  class FinalModelFlagsSimple < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      4
    end

    # Is the flags value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [FlagsSimple.new, 0]
      end

      [FlagsSimple.new(read_int32(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_int32(fbe_offset, value.value)
      fbe_size
    end
  end

  module FlagsTyped
    class Flags
      include FBE::Flags

      define :FLAG_VALUE_0, 0x00
      define :FLAG_VALUE_1, 0x01
      define :FLAG_VALUE_2, 0x02
      define :FLAG_VALUE_3, 0x04
      define :FLAG_VALUE_4, 0x08
      define :FLAG_VALUE_5, 0x10
      define :FLAG_VALUE_6, 0x20
      define :FLAG_VALUE_7, 0x40
      define :FLAG_VALUE_8, Flags.value(:FLAG_VALUE_7)
      define :FLAG_VALUE_9, Flags.value(:FLAG_VALUE_2)|Flags.value(:FLAG_VALUE_4)|Flags.value(:FLAG_VALUE_6)

      def initialize(value = 0)
        @value = value.is_a?(Flags) ? value.value : value
      end

      # Flags compare operators
      def ==(flags) @value == flags.value end
      def !=(flags) @value != flags.value end

      # Flags bit operators
      def ~
        Flags.new(~@value)
      end
      def &(flags) Flags.new(@value & flags.value) end
      def |(flags) Flags.new(@value | flags.value) end
      def ^(flags) Flags.new(@value ^ flags.value) end

      # Flags equals
      def eql?(other)
        self == other
      end

      # Flags hash code
      def hash
        @value.hash
      end

      # Is flags set?
      def has_flags(flags)
        ((@value & flags.value) != 0) && ((@value & flags.value) == flags.value)
      end

      # Set flags
      def set_flags(flags)
        @value |= flags.value
        self
      end

      # Remove flags
      def remove_flags(flags)
        @value &= ~flags.value
        self
      end

      # Get flags integer value
      def to_i
        @value
      end

      # Get flags string value
      def to_s
        result = ''
        first = true
        if ((@value & Flags.FLAG_VALUE_0) != 0) && ((@value & Flags.FLAG_VALUE_0) == Flags.FLAG_VALUE_0)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_0'
        end
        if ((@value & Flags.FLAG_VALUE_1) != 0) && ((@value & Flags.FLAG_VALUE_1) == Flags.FLAG_VALUE_1)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_1'
        end
        if ((@value & Flags.FLAG_VALUE_2) != 0) && ((@value & Flags.FLAG_VALUE_2) == Flags.FLAG_VALUE_2)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_2'
        end
        if ((@value & Flags.FLAG_VALUE_3) != 0) && ((@value & Flags.FLAG_VALUE_3) == Flags.FLAG_VALUE_3)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_3'
        end
        if ((@value & Flags.FLAG_VALUE_4) != 0) && ((@value & Flags.FLAG_VALUE_4) == Flags.FLAG_VALUE_4)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_4'
        end
        if ((@value & Flags.FLAG_VALUE_5) != 0) && ((@value & Flags.FLAG_VALUE_5) == Flags.FLAG_VALUE_5)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_5'
        end
        if ((@value & Flags.FLAG_VALUE_6) != 0) && ((@value & Flags.FLAG_VALUE_6) == Flags.FLAG_VALUE_6)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_6'
        end
        if ((@value & Flags.FLAG_VALUE_7) != 0) && ((@value & Flags.FLAG_VALUE_7) == Flags.FLAG_VALUE_7)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_7'
        end
        if ((@value & Flags.FLAG_VALUE_8) != 0) && ((@value & Flags.FLAG_VALUE_8) == Flags.FLAG_VALUE_8)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_8'
        end
        if ((@value & Flags.FLAG_VALUE_9) != 0) && ((@value & Flags.FLAG_VALUE_9) == Flags.FLAG_VALUE_9)
          if first
            # noinspection RubyUnusedLocalVariable
            first = false
          else
            result << '|'
          end
          result << 'FLAG_VALUE_9'
        end
        result
      end

      # Get flags JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
      attr_accessor :FLAG_VALUE_0
      attr_accessor :FLAG_VALUE_1
      attr_accessor :FLAG_VALUE_2
      attr_accessor :FLAG_VALUE_3
      attr_accessor :FLAG_VALUE_4
      attr_accessor :FLAG_VALUE_5
      attr_accessor :FLAG_VALUE_6
      attr_accessor :FLAG_VALUE_7
      attr_accessor :FLAG_VALUE_8
      attr_accessor :FLAG_VALUE_9
    end

    self.FLAG_VALUE_0 = Flags.new(Flags.FLAG_VALUE_0)
    self.FLAG_VALUE_1 = Flags.new(Flags.FLAG_VALUE_1)
    self.FLAG_VALUE_2 = Flags.new(Flags.FLAG_VALUE_2)
    self.FLAG_VALUE_3 = Flags.new(Flags.FLAG_VALUE_3)
    self.FLAG_VALUE_4 = Flags.new(Flags.FLAG_VALUE_4)
    self.FLAG_VALUE_5 = Flags.new(Flags.FLAG_VALUE_5)
    self.FLAG_VALUE_6 = Flags.new(Flags.FLAG_VALUE_6)
    self.FLAG_VALUE_7 = Flags.new(Flags.FLAG_VALUE_7)
    self.FLAG_VALUE_8 = Flags.new(Flags.FLAG_VALUE_8)
    self.FLAG_VALUE_9 = Flags.new(Flags.FLAG_VALUE_9)

    def self.new(value = 0)
      Flags.new(value)
    end

    # Get flags value from JSON
    def self.__from_json_map__(json)
      Flags.new(json)
    end
  end

  FlagsTyped.freeze

  # Fast Binary Encoding FlagsTyped field model
  class FieldModelFlagsTyped < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      8
    end

    # Get the value
    def get(defaults = FlagsTyped.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      FlagsTyped.new(read_uint64(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_uint64(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding FlagsTyped final model
  class FinalModelFlagsTyped < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      8
    end

    # Is the flags value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [FlagsTyped.new, 0]
      end

      [FlagsTyped.new(read_uint64(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_uint64(fbe_offset, value.value)
      fbe_size
    end
  end

  module FlagsEmpty
    class Flags
      include FBE::Flags
      def initialize(value = 0)
        @value = value.is_a?(Flags) ? value.value : value
      end

      # Flags compare operators
      def ==(flags) @value == flags.value end
      def !=(flags) @value != flags.value end

      # Flags bit operators
      def ~
        Flags.new(~@value)
      end
      def &(flags) Flags.new(@value & flags.value) end
      def |(flags) Flags.new(@value | flags.value) end
      def ^(flags) Flags.new(@value ^ flags.value) end

      # Flags equals
      def eql?(other)
        self == other
      end

      # Flags hash code
      def hash
        @value.hash
      end

      # Is flags set?
      def has_flags(flags)
        ((@value & flags.value) != 0) && ((@value & flags.value) == flags.value)
      end

      # Set flags
      def set_flags(flags)
        @value |= flags.value
        self
      end

      # Remove flags
      def remove_flags(flags)
        @value &= ~flags.value
        self
      end

      # Get flags integer value
      def to_i
        @value
      end

      # Get flags string value
      def to_s
        result = ''
        result
      end

      # Get flags JSON value
      def __to_json_map__
        @value
      end
    end

    class << self
    end

    def self.new(value = 0)
      Flags.new(value)
    end

    # Get flags value from JSON
    def self.__from_json_map__(json)
      Flags.new(json)
    end
  end

  FlagsEmpty.freeze

  # Fast Binary Encoding FlagsEmpty field model
  class FieldModelFlagsEmpty < FBE::FieldModel
    def initialize(buffer, offset)
        super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the value
    def get(defaults = FlagsEmpty.new)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return defaults
      end

      FlagsEmpty.new(read_int32(fbe_offset))
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return
      end

      write_int32(fbe_offset, value.value)
    end
  end

  # Fast Binary Encoding FlagsEmpty final model
  class FinalModelFlagsEmpty < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    # noinspection RubyUnusedLocalVariable
    def fbe_allocation_size(value)
      fbe_size
    end

    # Get the final size
    def fbe_size
      4
    end

    # Is the flags value valid?
    def valid?
      verify
    end

    # Check if the value is valid
    def verify
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return FBE::Integer::MAX
      end

      fbe_size
    end

    # Get the value
    def get
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return [FlagsEmpty.new, 0]
      end

      [FlagsEmpty.new(read_int32(fbe_offset)), fbe_size]
    end

    # Set the value
    def set(value)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      write_int32(fbe_offset, value.value)
      fbe_size
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructSimple
    include Comparable

    attr_accessor :id
    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10
    attr_accessor :f11
    attr_accessor :f12
    attr_accessor :f13
    attr_accessor :f14
    attr_accessor :f15
    attr_accessor :f16
    attr_accessor :f17
    attr_accessor :f18
    attr_accessor :f19
    attr_accessor :f20
    attr_accessor :f21
    attr_accessor :f22
    attr_accessor :f23
    attr_accessor :f24
    attr_accessor :f25
    attr_accessor :f26
    attr_accessor :f27
    attr_accessor :f28
    attr_accessor :f29
    attr_accessor :f30
    attr_accessor :f31
    attr_accessor :f32
    attr_accessor :f33
    attr_accessor :f34
    attr_accessor :f35
    attr_accessor :f36
    attr_accessor :f37
    attr_accessor :f38
    attr_accessor :f39
    attr_accessor :f40
    attr_accessor :f41
    attr_accessor :f42
    attr_accessor :f43
    attr_accessor :f44

    def initialize(id = 0, f1 = false, f2 = true, f3 = 0, f4 = 255, f5 = "\0", f6 = '!', f7 = "\0", f8 = 0x0444.chr(Encoding::UTF_8), f9 = 0, f10 = 127, f11 = 0, f12 = 255, f13 = 0, f14 = 32767, f15 = 0, f16 = 65535, f17 = 0, f18 = 2147483647, f19 = 0, f20 = 4294967295, f21 = 0, f22 = 9223372036854775807, f23 = 0, f24 = 18446744073709551615, f25 = 0.0, f26 = 123.456, f27 = 0.0, f28 = -123.456e+123, f29 = BigDecimal(0), f30 = BigDecimal('123456.123456'), f31 = '', f32 = "Initial string!", f33 = Time.utc(1970), f34 = Time.utc(1970), f35 = Time.now.utc, f36 = UUIDTools::UUID.parse_int(0), f37 = UUIDTools::UUID.timestamp_create, f38 = UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000"), f39 = Proto::OrderSide.new, f40 = Proto::OrderType.new, f41 = Proto::Order.new, f42 = Proto::Balance.new, f43 = Proto::State.new, f44 = Proto::Account.new)
      @id = id
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
      @f11 = f11
      @f12 = f12
      @f13 = f13
      @f14 = f14
      @f15 = f15
      @f16 = f16
      @f17 = f17
      @f18 = f18
      @f19 = f19
      @f20 = f20
      @f21 = f21
      @f22 = f22
      @f23 = f23
      @f24 = f24
      @f25 = f25
      @f26 = f26
      @f27 = f27
      @f28 = f28
      @f29 = f29
      @f30 = f30
      @f31 = f31
      @f32 = f32
      @f33 = f33
      @f34 = f34
      @f35 = f35
      @f36 = f36
      @f37 = f37
      @f38 = f38
      @f39 = f39
      @f40 = f40
      @f41 = f41
      @f42 = f42
      @f43 = f43
      @f44 = f44
    end

    def initialize_copy(other)
      @id = other.id
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
      @f11 = other.f11
      @f12 = other.f12
      @f13 = other.f13
      @f14 = other.f14
      @f15 = other.f15
      @f16 = other.f16
      @f17 = other.f17
      @f18 = other.f18
      @f19 = other.f19
      @f20 = other.f20
      @f21 = other.f21
      @f22 = other.f22
      @f23 = other.f23
      @f24 = other.f24
      @f25 = other.f25
      @f26 = other.f26
      @f27 = other.f27
      @f28 = other.f28
      @f29 = other.f29
      @f30 = other.f30
      @f31 = other.f31
      @f32 = other.f32
      @f33 = other.f33
      @f34 = other.f34
      @f35 = other.f35
      @f36 = other.f36
      @f37 = other.f37
      @f38 = other.f38
      @f39 = other.f39
      @f40 = other.f40
      @f41 = other.f41
      @f42 = other.f42
      @f43 = other.f43
      @f44 = other.f44
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructSimple)

      # noinspection RubyUnusedLocalVariable
      result = 0
      result = @id <=> other.id
      if result != 0
        return false
      end
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      result.push(@id)
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructSimple('
      result << 'id='
      if !@id.nil?
        result << @id.to_s
      else
        result << 'null'
      end
      result << ',f1='
      if !@f1.nil?
        result << (@f1 ? 'true' : 'false')
      else
        result << 'null'
      end
      result << ',f2='
      if !@f2.nil?
        result << (@f2 ? 'true' : 'false')
      else
        result << 'null'
      end
      result << ',f3='
      if !@f3.nil?
        result << @f3.to_s
      else
        result << 'null'
      end
      result << ',f4='
      if !@f4.nil?
        result << @f4.to_s
      else
        result << 'null'
      end
      result << ',f5='
      if !@f5.nil?
        result << "'" << @f5 << "'"
      else
        result << 'null'
      end
      result << ',f6='
      if !@f6.nil?
        result << "'" << @f6 << "'"
      else
        result << 'null'
      end
      result << ',f7='
      if !@f7.nil?
        result << "'" << @f7 << "'"
      else
        result << 'null'
      end
      result << ',f8='
      if !@f8.nil?
        result << "'" << @f8 << "'"
      else
        result << 'null'
      end
      result << ',f9='
      if !@f9.nil?
        result << @f9.to_s
      else
        result << 'null'
      end
      result << ',f10='
      if !@f10.nil?
        result << @f10.to_s
      else
        result << 'null'
      end
      result << ',f11='
      if !@f11.nil?
        result << @f11.to_s
      else
        result << 'null'
      end
      result << ',f12='
      if !@f12.nil?
        result << @f12.to_s
      else
        result << 'null'
      end
      result << ',f13='
      if !@f13.nil?
        result << @f13.to_s
      else
        result << 'null'
      end
      result << ',f14='
      if !@f14.nil?
        result << @f14.to_s
      else
        result << 'null'
      end
      result << ',f15='
      if !@f15.nil?
        result << @f15.to_s
      else
        result << 'null'
      end
      result << ',f16='
      if !@f16.nil?
        result << @f16.to_s
      else
        result << 'null'
      end
      result << ',f17='
      if !@f17.nil?
        result << @f17.to_s
      else
        result << 'null'
      end
      result << ',f18='
      if !@f18.nil?
        result << @f18.to_s
      else
        result << 'null'
      end
      result << ',f19='
      if !@f19.nil?
        result << @f19.to_s
      else
        result << 'null'
      end
      result << ',f20='
      if !@f20.nil?
        result << @f20.to_s
      else
        result << 'null'
      end
      result << ',f21='
      if !@f21.nil?
        result << @f21.to_s
      else
        result << 'null'
      end
      result << ',f22='
      if !@f22.nil?
        result << @f22.to_s
      else
        result << 'null'
      end
      result << ',f23='
      if !@f23.nil?
        result << @f23.to_s
      else
        result << 'null'
      end
      result << ',f24='
      if !@f24.nil?
        result << @f24.to_s
      else
        result << 'null'
      end
      result << ',f25='
      if !@f25.nil?
        result << @f25.to_s
      else
        result << 'null'
      end
      result << ',f26='
      if !@f26.nil?
        result << @f26.to_s
      else
        result << 'null'
      end
      result << ',f27='
      if !@f27.nil?
        result << @f27.to_s
      else
        result << 'null'
      end
      result << ',f28='
      if !@f28.nil?
        result << @f28.to_s
      else
        result << 'null'
      end
      result << ',f29='
      if !@f29.nil?
        result << @f29.to_s('F')
      else
        result << 'null'
      end
      result << ',f30='
      if !@f30.nil?
        result << @f30.to_s('F')
      else
        result << 'null'
      end
      result << ',f31='
      if !@f31.nil?
        result << '"' << @f31.to_s << '"'
      else
        result << 'null'
      end
      result << ',f32='
      if !@f32.nil?
        result << '"' << @f32.to_s << '"'
      else
        result << 'null'
      end
      result << ',f33='
      if !@f33.nil?
        result << (@f33.to_i * 1000000000 + @f33.nsec).to_s
      else
        result << 'null'
      end
      result << ',f34='
      if !@f34.nil?
        result << (@f34.to_i * 1000000000 + @f34.nsec).to_s
      else
        result << 'null'
      end
      result << ',f35='
      if !@f35.nil?
        result << (@f35.to_i * 1000000000 + @f35.nsec).to_s
      else
        result << 'null'
      end
      result << ',f36='
      if !@f36.nil?
        result << '"' << @f36.to_s << '"'
      else
        result << 'null'
      end
      result << ',f37='
      if !@f37.nil?
        result << '"' << @f37.to_s << '"'
      else
        result << 'null'
      end
      result << ',f38='
      if !@f38.nil?
        result << '"' << @f38.to_s << '"'
      else
        result << 'null'
      end
      result << ',f39='
      if !@f39.nil?
        result << @f39.to_s
      else
        result << 'null'
      end
      result << ',f40='
      if !@f40.nil?
        result << @f40.to_s
      else
        result << 'null'
      end
      result << ',f41='
      if !@f41.nil?
        result << @f41.to_s
      else
        result << 'null'
      end
      result << ',f42='
      if !@f42.nil?
        result << @f42.to_s
      else
        result << 'null'
      end
      result << ',f43='
      if !@f43.nil?
        result << @f43.to_s
      else
        result << 'null'
      end
      result << ',f44='
      if !@f44.nil?
        result << @f44.to_s
      else
        result << 'null'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructSimpleModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructSimpleModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'id'
      value = (id.nil? ? nil : id)
      result.store(key, value)
      key = 'f1'
      value = (f1.nil? ? nil : f1)
      result.store(key, value)
      key = 'f2'
      value = (f2.nil? ? nil : f2)
      result.store(key, value)
      key = 'f3'
      value = (f3.nil? ? nil : f3)
      result.store(key, value)
      key = 'f4'
      value = (f4.nil? ? nil : f4)
      result.store(key, value)
      key = 'f5'
      value = (f5.nil? ? nil : f5.ord)
      result.store(key, value)
      key = 'f6'
      value = (f6.nil? ? nil : f6.ord)
      result.store(key, value)
      key = 'f7'
      value = (f7.nil? ? nil : f7.ord)
      result.store(key, value)
      key = 'f8'
      value = (f8.nil? ? nil : f8.ord)
      result.store(key, value)
      key = 'f9'
      value = (f9.nil? ? nil : f9)
      result.store(key, value)
      key = 'f10'
      value = (f10.nil? ? nil : f10)
      result.store(key, value)
      key = 'f11'
      value = (f11.nil? ? nil : f11)
      result.store(key, value)
      key = 'f12'
      value = (f12.nil? ? nil : f12)
      result.store(key, value)
      key = 'f13'
      value = (f13.nil? ? nil : f13)
      result.store(key, value)
      key = 'f14'
      value = (f14.nil? ? nil : f14)
      result.store(key, value)
      key = 'f15'
      value = (f15.nil? ? nil : f15)
      result.store(key, value)
      key = 'f16'
      value = (f16.nil? ? nil : f16)
      result.store(key, value)
      key = 'f17'
      value = (f17.nil? ? nil : f17)
      result.store(key, value)
      key = 'f18'
      value = (f18.nil? ? nil : f18)
      result.store(key, value)
      key = 'f19'
      value = (f19.nil? ? nil : f19)
      result.store(key, value)
      key = 'f20'
      value = (f20.nil? ? nil : f20)
      result.store(key, value)
      key = 'f21'
      value = (f21.nil? ? nil : f21)
      result.store(key, value)
      key = 'f22'
      value = (f22.nil? ? nil : f22)
      result.store(key, value)
      key = 'f23'
      value = (f23.nil? ? nil : f23)
      result.store(key, value)
      key = 'f24'
      value = (f24.nil? ? nil : f24)
      result.store(key, value)
      key = 'f25'
      value = (f25.nil? ? nil : f25)
      result.store(key, value)
      key = 'f26'
      value = (f26.nil? ? nil : f26)
      result.store(key, value)
      key = 'f27'
      value = (f27.nil? ? nil : f27)
      result.store(key, value)
      key = 'f28'
      value = (f28.nil? ? nil : f28)
      result.store(key, value)
      key = 'f29'
      value = (f29.nil? ? nil : f29.to_s('F'))
      result.store(key, value)
      key = 'f30'
      value = (f30.nil? ? nil : f30.to_s('F'))
      result.store(key, value)
      key = 'f31'
      value = (f31.nil? ? nil : f31)
      result.store(key, value)
      key = 'f32'
      value = (f32.nil? ? nil : f32)
      result.store(key, value)
      key = 'f33'
      value = (f33.nil? ? nil : (f33.to_i * 1000000000 + f33.nsec))
      result.store(key, value)
      key = 'f34'
      value = (f34.nil? ? nil : (f34.to_i * 1000000000 + f34.nsec))
      result.store(key, value)
      key = 'f35'
      value = (f35.nil? ? nil : (f35.to_i * 1000000000 + f35.nsec))
      result.store(key, value)
      key = 'f36'
      value = (f36.nil? ? nil : f36)
      result.store(key, value)
      key = 'f37'
      value = (f37.nil? ? nil : f37)
      result.store(key, value)
      key = 'f38'
      value = (f38.nil? ? nil : f38)
      result.store(key, value)
      key = 'f39'
      value = (f39.nil? ? nil : f39.__to_json_map__)
      result.store(key, value)
      key = 'f40'
      value = (f40.nil? ? nil : f40.__to_json_map__)
      result.store(key, value)
      key = 'f41'
      value = (f41.nil? ? nil : f41.__to_json_map__)
      result.store(key, value)
      key = 'f42'
      value = (f42.nil? ? nil : f42.__to_json_map__)
      result.store(key, value)
      key = 'f43'
      value = (f43.nil? ? nil : f43.__to_json_map__)
      result.store(key, value)
      key = 'f44'
      value = (f44.nil? ? nil : f44.__to_json_map__)
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructSimple.new
      value = json.fetch('id', nil)
      result.id = (value.nil? ? nil : value)
      value = json.fetch('f1', nil)
      result.f1 = (value.nil? ? nil : value)
      value = json.fetch('f2', nil)
      result.f2 = (value.nil? ? nil : value)
      value = json.fetch('f3', nil)
      result.f3 = (value.nil? ? nil : value)
      value = json.fetch('f4', nil)
      result.f4 = (value.nil? ? nil : value)
      value = json.fetch('f5', nil)
      result.f5 = (value.nil? ? nil : value.chr)
      value = json.fetch('f6', nil)
      result.f6 = (value.nil? ? nil : value.chr)
      value = json.fetch('f7', nil)
      result.f7 = (value.nil? ? nil : value.chr(Encoding::UTF_8))
      value = json.fetch('f8', nil)
      result.f8 = (value.nil? ? nil : value.chr(Encoding::UTF_8))
      value = json.fetch('f9', nil)
      result.f9 = (value.nil? ? nil : value)
      value = json.fetch('f10', nil)
      result.f10 = (value.nil? ? nil : value)
      value = json.fetch('f11', nil)
      result.f11 = (value.nil? ? nil : value)
      value = json.fetch('f12', nil)
      result.f12 = (value.nil? ? nil : value)
      value = json.fetch('f13', nil)
      result.f13 = (value.nil? ? nil : value)
      value = json.fetch('f14', nil)
      result.f14 = (value.nil? ? nil : value)
      value = json.fetch('f15', nil)
      result.f15 = (value.nil? ? nil : value)
      value = json.fetch('f16', nil)
      result.f16 = (value.nil? ? nil : value)
      value = json.fetch('f17', nil)
      result.f17 = (value.nil? ? nil : value)
      value = json.fetch('f18', nil)
      result.f18 = (value.nil? ? nil : value)
      value = json.fetch('f19', nil)
      result.f19 = (value.nil? ? nil : value)
      value = json.fetch('f20', nil)
      result.f20 = (value.nil? ? nil : value)
      value = json.fetch('f21', nil)
      result.f21 = (value.nil? ? nil : value)
      value = json.fetch('f22', nil)
      result.f22 = (value.nil? ? nil : value)
      value = json.fetch('f23', nil)
      result.f23 = (value.nil? ? nil : value)
      value = json.fetch('f24', nil)
      result.f24 = (value.nil? ? nil : value)
      value = json.fetch('f25', nil)
      result.f25 = (value.nil? ? nil : value)
      value = json.fetch('f26', nil)
      result.f26 = (value.nil? ? nil : value)
      value = json.fetch('f27', nil)
      result.f27 = (value.nil? ? nil : value)
      value = json.fetch('f28', nil)
      result.f28 = (value.nil? ? nil : value)
      value = json.fetch('f29', nil)
      result.f29 = (value.nil? ? nil : BigDecimal(value))
      value = json.fetch('f30', nil)
      result.f30 = (value.nil? ? nil : BigDecimal(value))
      value = json.fetch('f31', nil)
      result.f31 = (value.nil? ? nil : value)
      value = json.fetch('f32', nil)
      result.f32 = (value.nil? ? nil : value)
      value = json.fetch('f33', nil)
      result.f33 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f34', nil)
      result.f34 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f35', nil)
      result.f35 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f36', nil)
      result.f36 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f37', nil)
      result.f37 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f38', nil)
      result.f38 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f39', nil)
      result.f39 = (value.nil? ? nil : Proto::OrderSide.__from_json_map__(value))
      value = json.fetch('f40', nil)
      result.f40 = (value.nil? ? nil : Proto::OrderType.__from_json_map__(value))
      value = json.fetch('f41', nil)
      result.f41 = (value.nil? ? nil : Proto::Order.__from_json_map__(value))
      value = json.fetch('f42', nil)
      result.f42 = (value.nil? ? nil : Proto::Balance.__from_json_map__(value))
      value = json.fetch('f43', nil)
      result.f43 = (value.nil? ? nil : Proto::State.__from_json_map__(value))
      value = json.fetch('f44', nil)
      result.f44 = (value.nil? ? nil : Proto::Account.__from_json_map__(value))
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 110
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructSimple < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_id = FBE::FieldModelInt32.new(self.buffer, 4 + 4)
      @_f1 = FBE::FieldModelBool.new(self.buffer, @_id.fbe_offset + @_id.fbe_size)
      @_f2 = FBE::FieldModelBool.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelByte.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelByte.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
      @_f5 = FBE::FieldModelChar.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size)
      @_f6 = FBE::FieldModelChar.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size)
      @_f7 = FBE::FieldModelWChar.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size)
      @_f8 = FBE::FieldModelWChar.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size)
      @_f9 = FBE::FieldModelInt8.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size)
      @_f10 = FBE::FieldModelInt8.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size)
      @_f11 = FBE::FieldModelUInt8.new(self.buffer, @_f10.fbe_offset + @_f10.fbe_size)
      @_f12 = FBE::FieldModelUInt8.new(self.buffer, @_f11.fbe_offset + @_f11.fbe_size)
      @_f13 = FBE::FieldModelInt16.new(self.buffer, @_f12.fbe_offset + @_f12.fbe_size)
      @_f14 = FBE::FieldModelInt16.new(self.buffer, @_f13.fbe_offset + @_f13.fbe_size)
      @_f15 = FBE::FieldModelUInt16.new(self.buffer, @_f14.fbe_offset + @_f14.fbe_size)
      @_f16 = FBE::FieldModelUInt16.new(self.buffer, @_f15.fbe_offset + @_f15.fbe_size)
      @_f17 = FBE::FieldModelInt32.new(self.buffer, @_f16.fbe_offset + @_f16.fbe_size)
      @_f18 = FBE::FieldModelInt32.new(self.buffer, @_f17.fbe_offset + @_f17.fbe_size)
      @_f19 = FBE::FieldModelUInt32.new(self.buffer, @_f18.fbe_offset + @_f18.fbe_size)
      @_f20 = FBE::FieldModelUInt32.new(self.buffer, @_f19.fbe_offset + @_f19.fbe_size)
      @_f21 = FBE::FieldModelInt64.new(self.buffer, @_f20.fbe_offset + @_f20.fbe_size)
      @_f22 = FBE::FieldModelInt64.new(self.buffer, @_f21.fbe_offset + @_f21.fbe_size)
      @_f23 = FBE::FieldModelUInt64.new(self.buffer, @_f22.fbe_offset + @_f22.fbe_size)
      @_f24 = FBE::FieldModelUInt64.new(self.buffer, @_f23.fbe_offset + @_f23.fbe_size)
      @_f25 = FBE::FieldModelFloat.new(self.buffer, @_f24.fbe_offset + @_f24.fbe_size)
      @_f26 = FBE::FieldModelFloat.new(self.buffer, @_f25.fbe_offset + @_f25.fbe_size)
      @_f27 = FBE::FieldModelDouble.new(self.buffer, @_f26.fbe_offset + @_f26.fbe_size)
      @_f28 = FBE::FieldModelDouble.new(self.buffer, @_f27.fbe_offset + @_f27.fbe_size)
      @_f29 = FBE::FieldModelDecimal.new(self.buffer, @_f28.fbe_offset + @_f28.fbe_size)
      @_f30 = FBE::FieldModelDecimal.new(self.buffer, @_f29.fbe_offset + @_f29.fbe_size)
      @_f31 = FBE::FieldModelString.new(self.buffer, @_f30.fbe_offset + @_f30.fbe_size)
      @_f32 = FBE::FieldModelString.new(self.buffer, @_f31.fbe_offset + @_f31.fbe_size)
      @_f33 = FBE::FieldModelTimestamp.new(self.buffer, @_f32.fbe_offset + @_f32.fbe_size)
      @_f34 = FBE::FieldModelTimestamp.new(self.buffer, @_f33.fbe_offset + @_f33.fbe_size)
      @_f35 = FBE::FieldModelTimestamp.new(self.buffer, @_f34.fbe_offset + @_f34.fbe_size)
      @_f36 = FBE::FieldModelUUID.new(self.buffer, @_f35.fbe_offset + @_f35.fbe_size)
      @_f37 = FBE::FieldModelUUID.new(self.buffer, @_f36.fbe_offset + @_f36.fbe_size)
      @_f38 = FBE::FieldModelUUID.new(self.buffer, @_f37.fbe_offset + @_f37.fbe_size)
      @_f39 = Proto::FieldModelOrderSide.new(self.buffer, @_f38.fbe_offset + @_f38.fbe_size)
      @_f40 = Proto::FieldModelOrderType.new(self.buffer, @_f39.fbe_offset + @_f39.fbe_size)
      @_f41 = Proto::FieldModelOrder.new(self.buffer, @_f40.fbe_offset + @_f40.fbe_size)
      @_f42 = Proto::FieldModelBalance.new(self.buffer, @_f41.fbe_offset + @_f41.fbe_size)
      @_f43 = Proto::FieldModelState.new(self.buffer, @_f42.fbe_offset + @_f42.fbe_size)
      @_f44 = Proto::FieldModelAccount.new(self.buffer, @_f43.fbe_offset + @_f43.fbe_size)
    end

    def id
      @_id
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    def f11
      @_f11
    end

    def f12
      @_f12
    end

    def f13
      @_f13
    end

    def f14
      @_f14
    end

    def f15
      @_f15
    end

    def f16
      @_f16
    end

    def f17
      @_f17
    end

    def f18
      @_f18
    end

    def f19
      @_f19
    end

    def f20
      @_f20
    end

    def f21
      @_f21
    end

    def f22
      @_f22
    end

    def f23
      @_f23
    end

    def f24
      @_f24
    end

    def f25
      @_f25
    end

    def f26
      @_f26
    end

    def f27
      @_f27
    end

    def f28
      @_f28
    end

    def f29
      @_f29
    end

    def f30
      @_f30
    end

    def f31
      @_f31
    end

    def f32
      @_f32
    end

    def f33
      @_f33
    end

    def f34
      @_f34
    end

    def f35
      @_f35
    end

    def f36
      @_f36
    end

    def f37
      @_f37
    end

    def f38
      @_f38
    end

    def f39
      @_f39
    end

    def f40
      @_f40
    end

    def f41
      @_f41
    end

    def f42
      @_f42
    end

    def f43
      @_f43
    end

    def f44
      @_f44
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + id.fbe_size \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
        + f11.fbe_size \
        + f12.fbe_size \
        + f13.fbe_size \
        + f14.fbe_size \
        + f15.fbe_size \
        + f16.fbe_size \
        + f17.fbe_size \
        + f18.fbe_size \
        + f19.fbe_size \
        + f20.fbe_size \
        + f21.fbe_size \
        + f22.fbe_size \
        + f23.fbe_size \
        + f24.fbe_size \
        + f25.fbe_size \
        + f26.fbe_size \
        + f27.fbe_size \
        + f28.fbe_size \
        + f29.fbe_size \
        + f30.fbe_size \
        + f31.fbe_size \
        + f32.fbe_size \
        + f33.fbe_size \
        + f34.fbe_size \
        + f35.fbe_size \
        + f36.fbe_size \
        + f37.fbe_size \
        + f38.fbe_size \
        + f39.fbe_size \
        + f40.fbe_size \
        + f41.fbe_size \
        + f42.fbe_size \
        + f43.fbe_size \
        + f44.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + id.fbe_extra \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \
        + f11.fbe_extra \
        + f12.fbe_extra \
        + f13.fbe_extra \
        + f14.fbe_extra \
        + f15.fbe_extra \
        + f16.fbe_extra \
        + f17.fbe_extra \
        + f18.fbe_extra \
        + f19.fbe_extra \
        + f20.fbe_extra \
        + f21.fbe_extra \
        + f22.fbe_extra \
        + f23.fbe_extra \
        + f24.fbe_extra \
        + f25.fbe_extra \
        + f26.fbe_extra \
        + f27.fbe_extra \
        + f28.fbe_extra \
        + f29.fbe_extra \
        + f30.fbe_extra \
        + f31.fbe_extra \
        + f32.fbe_extra \
        + f33.fbe_extra \
        + f34.fbe_extra \
        + f35.fbe_extra \
        + f36.fbe_extra \
        + f37.fbe_extra \
        + f38.fbe_extra \
        + f39.fbe_extra \
        + f40.fbe_extra \
        + f41.fbe_extra \
        + f42.fbe_extra \
        + f43.fbe_extra \
        + f44.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 110

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + id.fbe_size) > fbe_struct_size
        return true
      end
      unless id.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += id.fbe_size

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      if (fbe_current_size + f11.fbe_size) > fbe_struct_size
        return true
      end
      unless f11.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f11.fbe_size

      if (fbe_current_size + f12.fbe_size) > fbe_struct_size
        return true
      end
      unless f12.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f12.fbe_size

      if (fbe_current_size + f13.fbe_size) > fbe_struct_size
        return true
      end
      unless f13.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f13.fbe_size

      if (fbe_current_size + f14.fbe_size) > fbe_struct_size
        return true
      end
      unless f14.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f14.fbe_size

      if (fbe_current_size + f15.fbe_size) > fbe_struct_size
        return true
      end
      unless f15.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f15.fbe_size

      if (fbe_current_size + f16.fbe_size) > fbe_struct_size
        return true
      end
      unless f16.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f16.fbe_size

      if (fbe_current_size + f17.fbe_size) > fbe_struct_size
        return true
      end
      unless f17.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f17.fbe_size

      if (fbe_current_size + f18.fbe_size) > fbe_struct_size
        return true
      end
      unless f18.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f18.fbe_size

      if (fbe_current_size + f19.fbe_size) > fbe_struct_size
        return true
      end
      unless f19.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f19.fbe_size

      if (fbe_current_size + f20.fbe_size) > fbe_struct_size
        return true
      end
      unless f20.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f20.fbe_size

      if (fbe_current_size + f21.fbe_size) > fbe_struct_size
        return true
      end
      unless f21.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f21.fbe_size

      if (fbe_current_size + f22.fbe_size) > fbe_struct_size
        return true
      end
      unless f22.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f22.fbe_size

      if (fbe_current_size + f23.fbe_size) > fbe_struct_size
        return true
      end
      unless f23.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f23.fbe_size

      if (fbe_current_size + f24.fbe_size) > fbe_struct_size
        return true
      end
      unless f24.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f24.fbe_size

      if (fbe_current_size + f25.fbe_size) > fbe_struct_size
        return true
      end
      unless f25.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f25.fbe_size

      if (fbe_current_size + f26.fbe_size) > fbe_struct_size
        return true
      end
      unless f26.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f26.fbe_size

      if (fbe_current_size + f27.fbe_size) > fbe_struct_size
        return true
      end
      unless f27.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f27.fbe_size

      if (fbe_current_size + f28.fbe_size) > fbe_struct_size
        return true
      end
      unless f28.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f28.fbe_size

      if (fbe_current_size + f29.fbe_size) > fbe_struct_size
        return true
      end
      unless f29.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f29.fbe_size

      if (fbe_current_size + f30.fbe_size) > fbe_struct_size
        return true
      end
      unless f30.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f30.fbe_size

      if (fbe_current_size + f31.fbe_size) > fbe_struct_size
        return true
      end
      unless f31.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f31.fbe_size

      if (fbe_current_size + f32.fbe_size) > fbe_struct_size
        return true
      end
      unless f32.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f32.fbe_size

      if (fbe_current_size + f33.fbe_size) > fbe_struct_size
        return true
      end
      unless f33.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f33.fbe_size

      if (fbe_current_size + f34.fbe_size) > fbe_struct_size
        return true
      end
      unless f34.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f34.fbe_size

      if (fbe_current_size + f35.fbe_size) > fbe_struct_size
        return true
      end
      unless f35.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f35.fbe_size

      if (fbe_current_size + f36.fbe_size) > fbe_struct_size
        return true
      end
      unless f36.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f36.fbe_size

      if (fbe_current_size + f37.fbe_size) > fbe_struct_size
        return true
      end
      unless f37.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f37.fbe_size

      if (fbe_current_size + f38.fbe_size) > fbe_struct_size
        return true
      end
      unless f38.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f38.fbe_size

      if (fbe_current_size + f39.fbe_size) > fbe_struct_size
        return true
      end
      unless f39.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f39.fbe_size

      if (fbe_current_size + f40.fbe_size) > fbe_struct_size
        return true
      end
      unless f40.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f40.fbe_size

      if (fbe_current_size + f41.fbe_size) > fbe_struct_size
        return true
      end
      unless f41.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f41.fbe_size

      if (fbe_current_size + f42.fbe_size) > fbe_struct_size
        return true
      end
      unless f42.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f42.fbe_size

      if (fbe_current_size + f43.fbe_size) > fbe_struct_size
        return true
      end
      unless f43.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f43.fbe_size

      if (fbe_current_size + f44.fbe_size) > fbe_struct_size
        return true
      end
      unless f44.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f44.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructSimple.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + id.fbe_size) <= fbe_struct_size
        fbe_value.id = id.get
      else
        fbe_value.id = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += id.fbe_size

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        fbe_value.f1 = f1.get
      else
        fbe_value.f1 = false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        fbe_value.f2 = f2.get(true)
      else
        fbe_value.f2 = true
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        fbe_value.f3 = f3.get
      else
        fbe_value.f3 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        fbe_value.f4 = f4.get(255)
      else
        fbe_value.f4 = 255
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        fbe_value.f5 = f5.get
      else
        fbe_value.f5 = "\0"
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        fbe_value.f6 = f6.get('!')
      else
        fbe_value.f6 = '!'
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        fbe_value.f7 = f7.get
      else
        fbe_value.f7 = "\0"
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        fbe_value.f8 = f8.get(0x0444.chr(Encoding::UTF_8))
      else
        fbe_value.f8 = 0x0444.chr(Encoding::UTF_8)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        fbe_value.f9 = f9.get
      else
        fbe_value.f9 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        fbe_value.f10 = f10.get(127)
      else
        fbe_value.f10 = 127
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      if (fbe_current_size + f11.fbe_size) <= fbe_struct_size
        fbe_value.f11 = f11.get(0)
      else
        fbe_value.f11 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f11.fbe_size

      if (fbe_current_size + f12.fbe_size) <= fbe_struct_size
        fbe_value.f12 = f12.get(255)
      else
        fbe_value.f12 = 255
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f12.fbe_size

      if (fbe_current_size + f13.fbe_size) <= fbe_struct_size
        fbe_value.f13 = f13.get
      else
        fbe_value.f13 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f13.fbe_size

      if (fbe_current_size + f14.fbe_size) <= fbe_struct_size
        fbe_value.f14 = f14.get(32767)
      else
        fbe_value.f14 = 32767
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f14.fbe_size

      if (fbe_current_size + f15.fbe_size) <= fbe_struct_size
        fbe_value.f15 = f15.get(0)
      else
        fbe_value.f15 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f15.fbe_size

      if (fbe_current_size + f16.fbe_size) <= fbe_struct_size
        fbe_value.f16 = f16.get(65535)
      else
        fbe_value.f16 = 65535
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f16.fbe_size

      if (fbe_current_size + f17.fbe_size) <= fbe_struct_size
        fbe_value.f17 = f17.get
      else
        fbe_value.f17 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f17.fbe_size

      if (fbe_current_size + f18.fbe_size) <= fbe_struct_size
        fbe_value.f18 = f18.get(2147483647)
      else
        fbe_value.f18 = 2147483647
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f18.fbe_size

      if (fbe_current_size + f19.fbe_size) <= fbe_struct_size
        fbe_value.f19 = f19.get(0)
      else
        fbe_value.f19 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f19.fbe_size

      if (fbe_current_size + f20.fbe_size) <= fbe_struct_size
        fbe_value.f20 = f20.get(4294967295)
      else
        fbe_value.f20 = 4294967295
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f20.fbe_size

      if (fbe_current_size + f21.fbe_size) <= fbe_struct_size
        fbe_value.f21 = f21.get
      else
        fbe_value.f21 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f21.fbe_size

      if (fbe_current_size + f22.fbe_size) <= fbe_struct_size
        fbe_value.f22 = f22.get(9223372036854775807)
      else
        fbe_value.f22 = 9223372036854775807
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f22.fbe_size

      if (fbe_current_size + f23.fbe_size) <= fbe_struct_size
        fbe_value.f23 = f23.get(0)
      else
        fbe_value.f23 = 0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f23.fbe_size

      if (fbe_current_size + f24.fbe_size) <= fbe_struct_size
        fbe_value.f24 = f24.get(18446744073709551615)
      else
        fbe_value.f24 = 18446744073709551615
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f24.fbe_size

      if (fbe_current_size + f25.fbe_size) <= fbe_struct_size
        fbe_value.f25 = f25.get
      else
        fbe_value.f25 = 0.0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f25.fbe_size

      if (fbe_current_size + f26.fbe_size) <= fbe_struct_size
        fbe_value.f26 = f26.get(123.456)
      else
        fbe_value.f26 = 123.456
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f26.fbe_size

      if (fbe_current_size + f27.fbe_size) <= fbe_struct_size
        fbe_value.f27 = f27.get
      else
        fbe_value.f27 = 0.0
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f27.fbe_size

      if (fbe_current_size + f28.fbe_size) <= fbe_struct_size
        fbe_value.f28 = f28.get(-123.456e+123)
      else
        fbe_value.f28 = -123.456e+123
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f28.fbe_size

      if (fbe_current_size + f29.fbe_size) <= fbe_struct_size
        fbe_value.f29 = f29.get
      else
        fbe_value.f29 = BigDecimal(0)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f29.fbe_size

      if (fbe_current_size + f30.fbe_size) <= fbe_struct_size
        fbe_value.f30 = f30.get(BigDecimal('123456.123456'))
      else
        fbe_value.f30 = BigDecimal('123456.123456')
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f30.fbe_size

      if (fbe_current_size + f31.fbe_size) <= fbe_struct_size
        fbe_value.f31 = f31.get
      else
        fbe_value.f31 = ''
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f31.fbe_size

      if (fbe_current_size + f32.fbe_size) <= fbe_struct_size
        fbe_value.f32 = f32.get("Initial string!")
      else
        fbe_value.f32 = "Initial string!"
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f32.fbe_size

      if (fbe_current_size + f33.fbe_size) <= fbe_struct_size
        fbe_value.f33 = f33.get
      else
        fbe_value.f33 = Time.utc(1970)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f33.fbe_size

      if (fbe_current_size + f34.fbe_size) <= fbe_struct_size
        fbe_value.f34 = f34.get(Time.utc(1970))
      else
        fbe_value.f34 = Time.utc(1970)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f34.fbe_size

      if (fbe_current_size + f35.fbe_size) <= fbe_struct_size
        fbe_value.f35 = f35.get(Time.now.utc)
      else
        fbe_value.f35 = Time.now.utc
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f35.fbe_size

      if (fbe_current_size + f36.fbe_size) <= fbe_struct_size
        fbe_value.f36 = f36.get
      else
        fbe_value.f36 = UUIDTools::UUID.parse_int(0)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f36.fbe_size

      if (fbe_current_size + f37.fbe_size) <= fbe_struct_size
        fbe_value.f37 = f37.get(UUIDTools::UUID.timestamp_create)
      else
        fbe_value.f37 = UUIDTools::UUID.timestamp_create
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f37.fbe_size

      if (fbe_current_size + f38.fbe_size) <= fbe_struct_size
        fbe_value.f38 = f38.get(UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000"))
      else
        fbe_value.f38 = UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000")
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f38.fbe_size

      if (fbe_current_size + f39.fbe_size) <= fbe_struct_size
        fbe_value.f39 = f39.get
      else
        fbe_value.f39 = Proto::OrderSide.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f39.fbe_size

      if (fbe_current_size + f40.fbe_size) <= fbe_struct_size
        fbe_value.f40 = f40.get
      else
        fbe_value.f40 = Proto::OrderType.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f40.fbe_size

      if (fbe_current_size + f41.fbe_size) <= fbe_struct_size
        fbe_value.f41 = f41.get
      else
        fbe_value.f41 = Proto::Order.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f41.fbe_size

      if (fbe_current_size + f42.fbe_size) <= fbe_struct_size
        fbe_value.f42 = f42.get
      else
        fbe_value.f42 = Proto::Balance.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f42.fbe_size

      if (fbe_current_size + f43.fbe_size) <= fbe_struct_size
        fbe_value.f43 = f43.get
      else
        fbe_value.f43 = Proto::State.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f43.fbe_size

      if (fbe_current_size + f44.fbe_size) <= fbe_struct_size
        fbe_value.f44 = f44.get
      else
        fbe_value.f44 = Proto::Account.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f44.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      id.set(fbe_value.id)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
      f11.set(fbe_value.f11)
      f12.set(fbe_value.f12)
      f13.set(fbe_value.f13)
      f14.set(fbe_value.f14)
      f15.set(fbe_value.f15)
      f16.set(fbe_value.f16)
      f17.set(fbe_value.f17)
      f18.set(fbe_value.f18)
      f19.set(fbe_value.f19)
      f20.set(fbe_value.f20)
      f21.set(fbe_value.f21)
      f22.set(fbe_value.f22)
      f23.set(fbe_value.f23)
      f24.set(fbe_value.f24)
      f25.set(fbe_value.f25)
      f26.set(fbe_value.f26)
      f27.set(fbe_value.f27)
      f28.set(fbe_value.f28)
      f29.set(fbe_value.f29)
      f30.set(fbe_value.f30)
      f31.set(fbe_value.f31)
      f32.set(fbe_value.f32)
      f33.set(fbe_value.f33)
      f34.set(fbe_value.f34)
      f35.set(fbe_value.f35)
      f36.set(fbe_value.f36)
      f37.set(fbe_value.f37)
      f38.set(fbe_value.f38)
      f39.set(fbe_value.f39)
      f40.set(fbe_value.f40)
      f41.set(fbe_value.f41)
      f42.set(fbe_value.f42)
      f43.set(fbe_value.f43)
      f44.set(fbe_value.f44)
    end
  end

  # Fast Binary Encoding StructSimple model
  class StructSimpleModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructSimple.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructSimple::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructSimple.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructSimple.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructSimple.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructSimple < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_id = FBE::FinalModelInt32.new(self.buffer, 0)
      @_f1 = FBE::FinalModelBool.new(self.buffer, 0)
      @_f2 = FBE::FinalModelBool.new(self.buffer, 0)
      @_f3 = FBE::FinalModelByte.new(self.buffer, 0)
      @_f4 = FBE::FinalModelByte.new(self.buffer, 0)
      @_f5 = FBE::FinalModelChar.new(self.buffer, 0)
      @_f6 = FBE::FinalModelChar.new(self.buffer, 0)
      @_f7 = FBE::FinalModelWChar.new(self.buffer, 0)
      @_f8 = FBE::FinalModelWChar.new(self.buffer, 0)
      @_f9 = FBE::FinalModelInt8.new(self.buffer, 0)
      @_f10 = FBE::FinalModelInt8.new(self.buffer, 0)
      @_f11 = FBE::FinalModelUInt8.new(self.buffer, 0)
      @_f12 = FBE::FinalModelUInt8.new(self.buffer, 0)
      @_f13 = FBE::FinalModelInt16.new(self.buffer, 0)
      @_f14 = FBE::FinalModelInt16.new(self.buffer, 0)
      @_f15 = FBE::FinalModelUInt16.new(self.buffer, 0)
      @_f16 = FBE::FinalModelUInt16.new(self.buffer, 0)
      @_f17 = FBE::FinalModelInt32.new(self.buffer, 0)
      @_f18 = FBE::FinalModelInt32.new(self.buffer, 0)
      @_f19 = FBE::FinalModelUInt32.new(self.buffer, 0)
      @_f20 = FBE::FinalModelUInt32.new(self.buffer, 0)
      @_f21 = FBE::FinalModelInt64.new(self.buffer, 0)
      @_f22 = FBE::FinalModelInt64.new(self.buffer, 0)
      @_f23 = FBE::FinalModelUInt64.new(self.buffer, 0)
      @_f24 = FBE::FinalModelUInt64.new(self.buffer, 0)
      @_f25 = FBE::FinalModelFloat.new(self.buffer, 0)
      @_f26 = FBE::FinalModelFloat.new(self.buffer, 0)
      @_f27 = FBE::FinalModelDouble.new(self.buffer, 0)
      @_f28 = FBE::FinalModelDouble.new(self.buffer, 0)
      @_f29 = FBE::FinalModelDecimal.new(self.buffer, 0)
      @_f30 = FBE::FinalModelDecimal.new(self.buffer, 0)
      @_f31 = FBE::FinalModelString.new(self.buffer, 0)
      @_f32 = FBE::FinalModelString.new(self.buffer, 0)
      @_f33 = FBE::FinalModelTimestamp.new(self.buffer, 0)
      @_f34 = FBE::FinalModelTimestamp.new(self.buffer, 0)
      @_f35 = FBE::FinalModelTimestamp.new(self.buffer, 0)
      @_f36 = FBE::FinalModelUUID.new(self.buffer, 0)
      @_f37 = FBE::FinalModelUUID.new(self.buffer, 0)
      @_f38 = FBE::FinalModelUUID.new(self.buffer, 0)
      @_f39 = Proto::FinalModelOrderSide.new(self.buffer, 0)
      @_f40 = Proto::FinalModelOrderType.new(self.buffer, 0)
      @_f41 = Proto::FinalModelOrder.new(self.buffer, 0)
      @_f42 = Proto::FinalModelBalance.new(self.buffer, 0)
      @_f43 = Proto::FinalModelState.new(self.buffer, 0)
      @_f44 = Proto::FinalModelAccount.new(self.buffer, 0)
    end

    def id
      @_id
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    def f11
      @_f11
    end

    def f12
      @_f12
    end

    def f13
      @_f13
    end

    def f14
      @_f14
    end

    def f15
      @_f15
    end

    def f16
      @_f16
    end

    def f17
      @_f17
    end

    def f18
      @_f18
    end

    def f19
      @_f19
    end

    def f20
      @_f20
    end

    def f21
      @_f21
    end

    def f22
      @_f22
    end

    def f23
      @_f23
    end

    def f24
      @_f24
    end

    def f25
      @_f25
    end

    def f26
      @_f26
    end

    def f27
      @_f27
    end

    def f28
      @_f28
    end

    def f29
      @_f29
    end

    def f30
      @_f30
    end

    def f31
      @_f31
    end

    def f32
      @_f32
    end

    def f33
      @_f33
    end

    def f34
      @_f34
    end

    def f35
      @_f35
    end

    def f36
      @_f36
    end

    def f37
      @_f37
    end

    def f38
      @_f38
    end

    def f39
      @_f39
    end

    def f40
      @_f40
    end

    def f41
      @_f41
    end

    def f42
      @_f42
    end

    def f43
      @_f43
    end

    def f44
      @_f44
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + id.fbe_allocation_size(fbe_value.id) \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
        + f11.fbe_allocation_size(fbe_value.f11) \
        + f12.fbe_allocation_size(fbe_value.f12) \
        + f13.fbe_allocation_size(fbe_value.f13) \
        + f14.fbe_allocation_size(fbe_value.f14) \
        + f15.fbe_allocation_size(fbe_value.f15) \
        + f16.fbe_allocation_size(fbe_value.f16) \
        + f17.fbe_allocation_size(fbe_value.f17) \
        + f18.fbe_allocation_size(fbe_value.f18) \
        + f19.fbe_allocation_size(fbe_value.f19) \
        + f20.fbe_allocation_size(fbe_value.f20) \
        + f21.fbe_allocation_size(fbe_value.f21) \
        + f22.fbe_allocation_size(fbe_value.f22) \
        + f23.fbe_allocation_size(fbe_value.f23) \
        + f24.fbe_allocation_size(fbe_value.f24) \
        + f25.fbe_allocation_size(fbe_value.f25) \
        + f26.fbe_allocation_size(fbe_value.f26) \
        + f27.fbe_allocation_size(fbe_value.f27) \
        + f28.fbe_allocation_size(fbe_value.f28) \
        + f29.fbe_allocation_size(fbe_value.f29) \
        + f30.fbe_allocation_size(fbe_value.f30) \
        + f31.fbe_allocation_size(fbe_value.f31) \
        + f32.fbe_allocation_size(fbe_value.f32) \
        + f33.fbe_allocation_size(fbe_value.f33) \
        + f34.fbe_allocation_size(fbe_value.f34) \
        + f35.fbe_allocation_size(fbe_value.f35) \
        + f36.fbe_allocation_size(fbe_value.f36) \
        + f37.fbe_allocation_size(fbe_value.f37) \
        + f38.fbe_allocation_size(fbe_value.f38) \
        + f39.fbe_allocation_size(fbe_value.f39) \
        + f40.fbe_allocation_size(fbe_value.f40) \
        + f41.fbe_allocation_size(fbe_value.f41) \
        + f42.fbe_allocation_size(fbe_value.f42) \
        + f43.fbe_allocation_size(fbe_value.f43) \
        + f44.fbe_allocation_size(fbe_value.f44) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 110

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      id.fbe_offset = fbe_current_offset
      fbe_field_size = id.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f11.fbe_offset = fbe_current_offset
      fbe_field_size = f11.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f12.fbe_offset = fbe_current_offset
      fbe_field_size = f12.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f13.fbe_offset = fbe_current_offset
      fbe_field_size = f13.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f14.fbe_offset = fbe_current_offset
      fbe_field_size = f14.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f15.fbe_offset = fbe_current_offset
      fbe_field_size = f15.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f16.fbe_offset = fbe_current_offset
      fbe_field_size = f16.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f17.fbe_offset = fbe_current_offset
      fbe_field_size = f17.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f18.fbe_offset = fbe_current_offset
      fbe_field_size = f18.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f19.fbe_offset = fbe_current_offset
      fbe_field_size = f19.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f20.fbe_offset = fbe_current_offset
      fbe_field_size = f20.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f21.fbe_offset = fbe_current_offset
      fbe_field_size = f21.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f22.fbe_offset = fbe_current_offset
      fbe_field_size = f22.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f23.fbe_offset = fbe_current_offset
      fbe_field_size = f23.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f24.fbe_offset = fbe_current_offset
      fbe_field_size = f24.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f25.fbe_offset = fbe_current_offset
      fbe_field_size = f25.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f26.fbe_offset = fbe_current_offset
      fbe_field_size = f26.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f27.fbe_offset = fbe_current_offset
      fbe_field_size = f27.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f28.fbe_offset = fbe_current_offset
      fbe_field_size = f28.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f29.fbe_offset = fbe_current_offset
      fbe_field_size = f29.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f30.fbe_offset = fbe_current_offset
      fbe_field_size = f30.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f31.fbe_offset = fbe_current_offset
      fbe_field_size = f31.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f32.fbe_offset = fbe_current_offset
      fbe_field_size = f32.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f33.fbe_offset = fbe_current_offset
      fbe_field_size = f33.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f34.fbe_offset = fbe_current_offset
      fbe_field_size = f34.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f35.fbe_offset = fbe_current_offset
      fbe_field_size = f35.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f36.fbe_offset = fbe_current_offset
      fbe_field_size = f36.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f37.fbe_offset = fbe_current_offset
      fbe_field_size = f37.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f38.fbe_offset = fbe_current_offset
      fbe_field_size = f38.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f39.fbe_offset = fbe_current_offset
      fbe_field_size = f39.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f40.fbe_offset = fbe_current_offset
      fbe_field_size = f40.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f41.fbe_offset = fbe_current_offset
      fbe_field_size = f41.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f42.fbe_offset = fbe_current_offset
      fbe_field_size = f42.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f43.fbe_offset = fbe_current_offset
      fbe_field_size = f43.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f44.fbe_offset = fbe_current_offset
      fbe_field_size = f44.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructSimple.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      id.fbe_offset = fbe_current_offset
      fbe_result = id.get
      fbe_value.id = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get
      fbe_value.f1 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get
      fbe_value.f2 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get
      fbe_value.f3 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get
      fbe_value.f4 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get
      fbe_value.f5 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get
      fbe_value.f6 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get
      fbe_value.f7 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get
      fbe_value.f8 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get
      fbe_value.f9 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get
      fbe_value.f10 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f11.fbe_offset = fbe_current_offset
      fbe_result = f11.get
      fbe_value.f11 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f12.fbe_offset = fbe_current_offset
      fbe_result = f12.get
      fbe_value.f12 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f13.fbe_offset = fbe_current_offset
      fbe_result = f13.get
      fbe_value.f13 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f14.fbe_offset = fbe_current_offset
      fbe_result = f14.get
      fbe_value.f14 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f15.fbe_offset = fbe_current_offset
      fbe_result = f15.get
      fbe_value.f15 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f16.fbe_offset = fbe_current_offset
      fbe_result = f16.get
      fbe_value.f16 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f17.fbe_offset = fbe_current_offset
      fbe_result = f17.get
      fbe_value.f17 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f18.fbe_offset = fbe_current_offset
      fbe_result = f18.get
      fbe_value.f18 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f19.fbe_offset = fbe_current_offset
      fbe_result = f19.get
      fbe_value.f19 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f20.fbe_offset = fbe_current_offset
      fbe_result = f20.get
      fbe_value.f20 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f21.fbe_offset = fbe_current_offset
      fbe_result = f21.get
      fbe_value.f21 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f22.fbe_offset = fbe_current_offset
      fbe_result = f22.get
      fbe_value.f22 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f23.fbe_offset = fbe_current_offset
      fbe_result = f23.get
      fbe_value.f23 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f24.fbe_offset = fbe_current_offset
      fbe_result = f24.get
      fbe_value.f24 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f25.fbe_offset = fbe_current_offset
      fbe_result = f25.get
      fbe_value.f25 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f26.fbe_offset = fbe_current_offset
      fbe_result = f26.get
      fbe_value.f26 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f27.fbe_offset = fbe_current_offset
      fbe_result = f27.get
      fbe_value.f27 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f28.fbe_offset = fbe_current_offset
      fbe_result = f28.get
      fbe_value.f28 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f29.fbe_offset = fbe_current_offset
      fbe_result = f29.get
      fbe_value.f29 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f30.fbe_offset = fbe_current_offset
      fbe_result = f30.get
      fbe_value.f30 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f31.fbe_offset = fbe_current_offset
      fbe_result = f31.get
      fbe_value.f31 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f32.fbe_offset = fbe_current_offset
      fbe_result = f32.get
      fbe_value.f32 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f33.fbe_offset = fbe_current_offset
      fbe_result = f33.get
      fbe_value.f33 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f34.fbe_offset = fbe_current_offset
      fbe_result = f34.get
      fbe_value.f34 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f35.fbe_offset = fbe_current_offset
      fbe_result = f35.get
      fbe_value.f35 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f36.fbe_offset = fbe_current_offset
      fbe_result = f36.get
      fbe_value.f36 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f37.fbe_offset = fbe_current_offset
      fbe_result = f37.get
      fbe_value.f37 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f38.fbe_offset = fbe_current_offset
      fbe_result = f38.get
      fbe_value.f38 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f39.fbe_offset = fbe_current_offset
      fbe_result = f39.get
      fbe_value.f39 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f40.fbe_offset = fbe_current_offset
      fbe_result = f40.get
      fbe_value.f40 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f41.fbe_offset = fbe_current_offset
      fbe_result = f41.get
      fbe_value.f41 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f42.fbe_offset = fbe_current_offset
      fbe_result = f42.get
      fbe_value.f42 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f43.fbe_offset = fbe_current_offset
      fbe_result = f43.get
      fbe_value.f43 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f44.fbe_offset = fbe_current_offset
      fbe_result = f44.get
      fbe_value.f44 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      id.fbe_offset = fbe_current_offset
      fbe_field_size = id.set(fbe_value.id)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f11.fbe_offset = fbe_current_offset
      fbe_field_size = f11.set(fbe_value.f11)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f12.fbe_offset = fbe_current_offset
      fbe_field_size = f12.set(fbe_value.f12)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f13.fbe_offset = fbe_current_offset
      fbe_field_size = f13.set(fbe_value.f13)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f14.fbe_offset = fbe_current_offset
      fbe_field_size = f14.set(fbe_value.f14)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f15.fbe_offset = fbe_current_offset
      fbe_field_size = f15.set(fbe_value.f15)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f16.fbe_offset = fbe_current_offset
      fbe_field_size = f16.set(fbe_value.f16)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f17.fbe_offset = fbe_current_offset
      fbe_field_size = f17.set(fbe_value.f17)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f18.fbe_offset = fbe_current_offset
      fbe_field_size = f18.set(fbe_value.f18)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f19.fbe_offset = fbe_current_offset
      fbe_field_size = f19.set(fbe_value.f19)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f20.fbe_offset = fbe_current_offset
      fbe_field_size = f20.set(fbe_value.f20)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f21.fbe_offset = fbe_current_offset
      fbe_field_size = f21.set(fbe_value.f21)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f22.fbe_offset = fbe_current_offset
      fbe_field_size = f22.set(fbe_value.f22)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f23.fbe_offset = fbe_current_offset
      fbe_field_size = f23.set(fbe_value.f23)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f24.fbe_offset = fbe_current_offset
      fbe_field_size = f24.set(fbe_value.f24)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f25.fbe_offset = fbe_current_offset
      fbe_field_size = f25.set(fbe_value.f25)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f26.fbe_offset = fbe_current_offset
      fbe_field_size = f26.set(fbe_value.f26)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f27.fbe_offset = fbe_current_offset
      fbe_field_size = f27.set(fbe_value.f27)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f28.fbe_offset = fbe_current_offset
      fbe_field_size = f28.set(fbe_value.f28)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f29.fbe_offset = fbe_current_offset
      fbe_field_size = f29.set(fbe_value.f29)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f30.fbe_offset = fbe_current_offset
      fbe_field_size = f30.set(fbe_value.f30)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f31.fbe_offset = fbe_current_offset
      fbe_field_size = f31.set(fbe_value.f31)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f32.fbe_offset = fbe_current_offset
      fbe_field_size = f32.set(fbe_value.f32)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f33.fbe_offset = fbe_current_offset
      fbe_field_size = f33.set(fbe_value.f33)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f34.fbe_offset = fbe_current_offset
      fbe_field_size = f34.set(fbe_value.f34)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f35.fbe_offset = fbe_current_offset
      fbe_field_size = f35.set(fbe_value.f35)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f36.fbe_offset = fbe_current_offset
      fbe_field_size = f36.set(fbe_value.f36)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f37.fbe_offset = fbe_current_offset
      fbe_field_size = f37.set(fbe_value.f37)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f38.fbe_offset = fbe_current_offset
      fbe_field_size = f38.set(fbe_value.f38)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f39.fbe_offset = fbe_current_offset
      fbe_field_size = f39.set(fbe_value.f39)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f40.fbe_offset = fbe_current_offset
      fbe_field_size = f40.set(fbe_value.f40)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f41.fbe_offset = fbe_current_offset
      fbe_field_size = f41.set(fbe_value.f41)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f42.fbe_offset = fbe_current_offset
      fbe_field_size = f42.set(fbe_value.f42)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f43.fbe_offset = fbe_current_offset
      fbe_field_size = f43.set(fbe_value.f43)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f44.fbe_offset = fbe_current_offset
      fbe_field_size = f44.set(fbe_value.f44)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructSimple final model
  class StructSimpleFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructSimple.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructSimple::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructSimple.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructSimple.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructSimple.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructOptional < StructSimple
    include Comparable

    attr_accessor :f100
    attr_accessor :f101
    attr_accessor :f102
    attr_accessor :f103
    attr_accessor :f104
    attr_accessor :f105
    attr_accessor :f106
    attr_accessor :f107
    attr_accessor :f108
    attr_accessor :f109
    attr_accessor :f110
    attr_accessor :f111
    attr_accessor :f112
    attr_accessor :f113
    attr_accessor :f114
    attr_accessor :f115
    attr_accessor :f116
    attr_accessor :f117
    attr_accessor :f118
    attr_accessor :f119
    attr_accessor :f120
    attr_accessor :f121
    attr_accessor :f122
    attr_accessor :f123
    attr_accessor :f124
    attr_accessor :f125
    attr_accessor :f126
    attr_accessor :f127
    attr_accessor :f128
    attr_accessor :f129
    attr_accessor :f130
    attr_accessor :f131
    attr_accessor :f132
    attr_accessor :f133
    attr_accessor :f134
    attr_accessor :f135
    attr_accessor :f136
    attr_accessor :f137
    attr_accessor :f138
    attr_accessor :f139
    attr_accessor :f140
    attr_accessor :f141
    attr_accessor :f142
    attr_accessor :f143
    attr_accessor :f144
    attr_accessor :f145
    attr_accessor :f146
    attr_accessor :f147
    attr_accessor :f148
    attr_accessor :f149
    attr_accessor :f150
    attr_accessor :f151
    attr_accessor :f152
    attr_accessor :f153
    attr_accessor :f154
    attr_accessor :f155
    attr_accessor :f156
    attr_accessor :f157
    attr_accessor :f158
    attr_accessor :f159
    attr_accessor :f160
    attr_accessor :f161
    attr_accessor :f162
    attr_accessor :f163
    attr_accessor :f164
    attr_accessor :f165

    def initialize(parent = StructSimple.new, f100 = nil, f101 = true, f102 = nil, f103 = nil, f104 = 255, f105 = nil, f106 = nil, f107 = '!', f108 = nil, f109 = nil, f110 = 0x0444.chr(Encoding::UTF_8), f111 = nil, f112 = nil, f113 = 127, f114 = nil, f115 = nil, f116 = 255, f117 = nil, f118 = nil, f119 = 32767, f120 = nil, f121 = nil, f122 = 65535, f123 = nil, f124 = nil, f125 = 2147483647, f126 = nil, f127 = nil, f128 = 4294967295, f129 = nil, f130 = nil, f131 = 9223372036854775807, f132 = nil, f133 = nil, f134 = 18446744073709551615, f135 = nil, f136 = nil, f137 = 123.456, f138 = nil, f139 = nil, f140 = -123.456e+123, f141 = nil, f142 = nil, f143 = BigDecimal('123456.123456'), f144 = nil, f145 = nil, f146 = "Initial string!", f147 = nil, f148 = nil, f149 = Time.now.utc, f150 = nil, f151 = nil, f152 = UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000"), f153 = nil, f154 = nil, f155 = nil, f156 = nil, f157 = nil, f158 = nil, f159 = nil, f160 = nil, f161 = nil, f162 = nil, f163 = nil, f164 = nil, f165 = nil)
      method(:initialize_copy).super_method.call(parent)
      @f100 = f100
      @f101 = f101
      @f102 = f102
      @f103 = f103
      @f104 = f104
      @f105 = f105
      @f106 = f106
      @f107 = f107
      @f108 = f108
      @f109 = f109
      @f110 = f110
      @f111 = f111
      @f112 = f112
      @f113 = f113
      @f114 = f114
      @f115 = f115
      @f116 = f116
      @f117 = f117
      @f118 = f118
      @f119 = f119
      @f120 = f120
      @f121 = f121
      @f122 = f122
      @f123 = f123
      @f124 = f124
      @f125 = f125
      @f126 = f126
      @f127 = f127
      @f128 = f128
      @f129 = f129
      @f130 = f130
      @f131 = f131
      @f132 = f132
      @f133 = f133
      @f134 = f134
      @f135 = f135
      @f136 = f136
      @f137 = f137
      @f138 = f138
      @f139 = f139
      @f140 = f140
      @f141 = f141
      @f142 = f142
      @f143 = f143
      @f144 = f144
      @f145 = f145
      @f146 = f146
      @f147 = f147
      @f148 = f148
      @f149 = f149
      @f150 = f150
      @f151 = f151
      @f152 = f152
      @f153 = f153
      @f154 = f154
      @f155 = f155
      @f156 = f156
      @f157 = f157
      @f158 = f158
      @f159 = f159
      @f160 = f160
      @f161 = f161
      @f162 = f162
      @f163 = f163
      @f164 = f164
      @f165 = f165
    end

    def initialize_copy(other)
      super(other)
      @f100 = other.f100
      @f101 = other.f101
      @f102 = other.f102
      @f103 = other.f103
      @f104 = other.f104
      @f105 = other.f105
      @f106 = other.f106
      @f107 = other.f107
      @f108 = other.f108
      @f109 = other.f109
      @f110 = other.f110
      @f111 = other.f111
      @f112 = other.f112
      @f113 = other.f113
      @f114 = other.f114
      @f115 = other.f115
      @f116 = other.f116
      @f117 = other.f117
      @f118 = other.f118
      @f119 = other.f119
      @f120 = other.f120
      @f121 = other.f121
      @f122 = other.f122
      @f123 = other.f123
      @f124 = other.f124
      @f125 = other.f125
      @f126 = other.f126
      @f127 = other.f127
      @f128 = other.f128
      @f129 = other.f129
      @f130 = other.f130
      @f131 = other.f131
      @f132 = other.f132
      @f133 = other.f133
      @f134 = other.f134
      @f135 = other.f135
      @f136 = other.f136
      @f137 = other.f137
      @f138 = other.f138
      @f139 = other.f139
      @f140 = other.f140
      @f141 = other.f141
      @f142 = other.f142
      @f143 = other.f143
      @f144 = other.f144
      @f145 = other.f145
      @f146 = other.f146
      @f147 = other.f147
      @f148 = other.f148
      @f149 = other.f149
      @f150 = other.f150
      @f151 = other.f151
      @f152 = other.f152
      @f153 = other.f153
      @f154 = other.f154
      @f155 = other.f155
      @f156 = other.f156
      @f157 = other.f157
      @f158 = other.f158
      @f159 = other.f159
      @f160 = other.f160
      @f161 = other.f161
      @f162 = other.f162
      @f163 = other.f163
      @f164 = other.f164
      @f165 = other.f165
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructOptional)

      # noinspection RubyUnusedLocalVariable
      result = 0
      result = super
      if result != 0
        return result
      end
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      result.push(super)
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructOptional('
      result << super
      result << ',f100='
      if !@f100.nil?
        result << (@f100 ? 'true' : 'false')
      else
        result << 'null'
      end
      result << ',f101='
      if !@f101.nil?
        result << (@f101 ? 'true' : 'false')
      else
        result << 'null'
      end
      result << ',f102='
      if !@f102.nil?
        result << (@f102 ? 'true' : 'false')
      else
        result << 'null'
      end
      result << ',f103='
      if !@f103.nil?
        result << @f103.to_s
      else
        result << 'null'
      end
      result << ',f104='
      if !@f104.nil?
        result << @f104.to_s
      else
        result << 'null'
      end
      result << ',f105='
      if !@f105.nil?
        result << @f105.to_s
      else
        result << 'null'
      end
      result << ',f106='
      if !@f106.nil?
        result << "'" << @f106 << "'"
      else
        result << 'null'
      end
      result << ',f107='
      if !@f107.nil?
        result << "'" << @f107 << "'"
      else
        result << 'null'
      end
      result << ',f108='
      if !@f108.nil?
        result << "'" << @f108 << "'"
      else
        result << 'null'
      end
      result << ',f109='
      if !@f109.nil?
        result << "'" << @f109 << "'"
      else
        result << 'null'
      end
      result << ',f110='
      if !@f110.nil?
        result << "'" << @f110 << "'"
      else
        result << 'null'
      end
      result << ',f111='
      if !@f111.nil?
        result << "'" << @f111 << "'"
      else
        result << 'null'
      end
      result << ',f112='
      if !@f112.nil?
        result << @f112.to_s
      else
        result << 'null'
      end
      result << ',f113='
      if !@f113.nil?
        result << @f113.to_s
      else
        result << 'null'
      end
      result << ',f114='
      if !@f114.nil?
        result << @f114.to_s
      else
        result << 'null'
      end
      result << ',f115='
      if !@f115.nil?
        result << @f115.to_s
      else
        result << 'null'
      end
      result << ',f116='
      if !@f116.nil?
        result << @f116.to_s
      else
        result << 'null'
      end
      result << ',f117='
      if !@f117.nil?
        result << @f117.to_s
      else
        result << 'null'
      end
      result << ',f118='
      if !@f118.nil?
        result << @f118.to_s
      else
        result << 'null'
      end
      result << ',f119='
      if !@f119.nil?
        result << @f119.to_s
      else
        result << 'null'
      end
      result << ',f120='
      if !@f120.nil?
        result << @f120.to_s
      else
        result << 'null'
      end
      result << ',f121='
      if !@f121.nil?
        result << @f121.to_s
      else
        result << 'null'
      end
      result << ',f122='
      if !@f122.nil?
        result << @f122.to_s
      else
        result << 'null'
      end
      result << ',f123='
      if !@f123.nil?
        result << @f123.to_s
      else
        result << 'null'
      end
      result << ',f124='
      if !@f124.nil?
        result << @f124.to_s
      else
        result << 'null'
      end
      result << ',f125='
      if !@f125.nil?
        result << @f125.to_s
      else
        result << 'null'
      end
      result << ',f126='
      if !@f126.nil?
        result << @f126.to_s
      else
        result << 'null'
      end
      result << ',f127='
      if !@f127.nil?
        result << @f127.to_s
      else
        result << 'null'
      end
      result << ',f128='
      if !@f128.nil?
        result << @f128.to_s
      else
        result << 'null'
      end
      result << ',f129='
      if !@f129.nil?
        result << @f129.to_s
      else
        result << 'null'
      end
      result << ',f130='
      if !@f130.nil?
        result << @f130.to_s
      else
        result << 'null'
      end
      result << ',f131='
      if !@f131.nil?
        result << @f131.to_s
      else
        result << 'null'
      end
      result << ',f132='
      if !@f132.nil?
        result << @f132.to_s
      else
        result << 'null'
      end
      result << ',f133='
      if !@f133.nil?
        result << @f133.to_s
      else
        result << 'null'
      end
      result << ',f134='
      if !@f134.nil?
        result << @f134.to_s
      else
        result << 'null'
      end
      result << ',f135='
      if !@f135.nil?
        result << @f135.to_s
      else
        result << 'null'
      end
      result << ',f136='
      if !@f136.nil?
        result << @f136.to_s
      else
        result << 'null'
      end
      result << ',f137='
      if !@f137.nil?
        result << @f137.to_s
      else
        result << 'null'
      end
      result << ',f138='
      if !@f138.nil?
        result << @f138.to_s
      else
        result << 'null'
      end
      result << ',f139='
      if !@f139.nil?
        result << @f139.to_s
      else
        result << 'null'
      end
      result << ',f140='
      if !@f140.nil?
        result << @f140.to_s
      else
        result << 'null'
      end
      result << ',f141='
      if !@f141.nil?
        result << @f141.to_s
      else
        result << 'null'
      end
      result << ',f142='
      if !@f142.nil?
        result << @f142.to_s('F')
      else
        result << 'null'
      end
      result << ',f143='
      if !@f143.nil?
        result << @f143.to_s('F')
      else
        result << 'null'
      end
      result << ',f144='
      if !@f144.nil?
        result << @f144.to_s('F')
      else
        result << 'null'
      end
      result << ',f145='
      if !@f145.nil?
        result << '"' << @f145.to_s << '"'
      else
        result << 'null'
      end
      result << ',f146='
      if !@f146.nil?
        result << '"' << @f146.to_s << '"'
      else
        result << 'null'
      end
      result << ',f147='
      if !@f147.nil?
        result << '"' << @f147.to_s << '"'
      else
        result << 'null'
      end
      result << ',f148='
      if !@f148.nil?
        result << (@f148.to_i * 1000000000 + @f148.nsec).to_s
      else
        result << 'null'
      end
      result << ',f149='
      if !@f149.nil?
        result << (@f149.to_i * 1000000000 + @f149.nsec).to_s
      else
        result << 'null'
      end
      result << ',f150='
      if !@f150.nil?
        result << (@f150.to_i * 1000000000 + @f150.nsec).to_s
      else
        result << 'null'
      end
      result << ',f151='
      if !@f151.nil?
        result << '"' << @f151.to_s << '"'
      else
        result << 'null'
      end
      result << ',f152='
      if !@f152.nil?
        result << '"' << @f152.to_s << '"'
      else
        result << 'null'
      end
      result << ',f153='
      if !@f153.nil?
        result << '"' << @f153.to_s << '"'
      else
        result << 'null'
      end
      result << ',f154='
      if !@f154.nil?
        result << @f154.to_s
      else
        result << 'null'
      end
      result << ',f155='
      if !@f155.nil?
        result << @f155.to_s
      else
        result << 'null'
      end
      result << ',f156='
      if !@f156.nil?
        result << @f156.to_s
      else
        result << 'null'
      end
      result << ',f157='
      if !@f157.nil?
        result << @f157.to_s
      else
        result << 'null'
      end
      result << ',f158='
      if !@f158.nil?
        result << @f158.to_s
      else
        result << 'null'
      end
      result << ',f159='
      if !@f159.nil?
        result << @f159.to_s
      else
        result << 'null'
      end
      result << ',f160='
      if !@f160.nil?
        result << @f160.to_s
      else
        result << 'null'
      end
      result << ',f161='
      if !@f161.nil?
        result << @f161.to_s
      else
        result << 'null'
      end
      result << ',f162='
      if !@f162.nil?
        result << @f162.to_s
      else
        result << 'null'
      end
      result << ',f163='
      if !@f163.nil?
        result << @f163.to_s
      else
        result << 'null'
      end
      result << ',f164='
      if !@f164.nil?
        result << @f164.to_s
      else
        result << 'null'
      end
      result << ',f165='
      if !@f165.nil?
        result << @f165.to_s
      else
        result << 'null'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructOptionalModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructOptionalModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      result.update(super)
      key = 'f100'
      value = (f100.nil? ? nil : f100)
      result.store(key, value)
      key = 'f101'
      value = (f101.nil? ? nil : f101)
      result.store(key, value)
      key = 'f102'
      value = (f102.nil? ? nil : f102)
      result.store(key, value)
      key = 'f103'
      value = (f103.nil? ? nil : f103)
      result.store(key, value)
      key = 'f104'
      value = (f104.nil? ? nil : f104)
      result.store(key, value)
      key = 'f105'
      value = (f105.nil? ? nil : f105)
      result.store(key, value)
      key = 'f106'
      value = (f106.nil? ? nil : f106.ord)
      result.store(key, value)
      key = 'f107'
      value = (f107.nil? ? nil : f107.ord)
      result.store(key, value)
      key = 'f108'
      value = (f108.nil? ? nil : f108.ord)
      result.store(key, value)
      key = 'f109'
      value = (f109.nil? ? nil : f109.ord)
      result.store(key, value)
      key = 'f110'
      value = (f110.nil? ? nil : f110.ord)
      result.store(key, value)
      key = 'f111'
      value = (f111.nil? ? nil : f111.ord)
      result.store(key, value)
      key = 'f112'
      value = (f112.nil? ? nil : f112)
      result.store(key, value)
      key = 'f113'
      value = (f113.nil? ? nil : f113)
      result.store(key, value)
      key = 'f114'
      value = (f114.nil? ? nil : f114)
      result.store(key, value)
      key = 'f115'
      value = (f115.nil? ? nil : f115)
      result.store(key, value)
      key = 'f116'
      value = (f116.nil? ? nil : f116)
      result.store(key, value)
      key = 'f117'
      value = (f117.nil? ? nil : f117)
      result.store(key, value)
      key = 'f118'
      value = (f118.nil? ? nil : f118)
      result.store(key, value)
      key = 'f119'
      value = (f119.nil? ? nil : f119)
      result.store(key, value)
      key = 'f120'
      value = (f120.nil? ? nil : f120)
      result.store(key, value)
      key = 'f121'
      value = (f121.nil? ? nil : f121)
      result.store(key, value)
      key = 'f122'
      value = (f122.nil? ? nil : f122)
      result.store(key, value)
      key = 'f123'
      value = (f123.nil? ? nil : f123)
      result.store(key, value)
      key = 'f124'
      value = (f124.nil? ? nil : f124)
      result.store(key, value)
      key = 'f125'
      value = (f125.nil? ? nil : f125)
      result.store(key, value)
      key = 'f126'
      value = (f126.nil? ? nil : f126)
      result.store(key, value)
      key = 'f127'
      value = (f127.nil? ? nil : f127)
      result.store(key, value)
      key = 'f128'
      value = (f128.nil? ? nil : f128)
      result.store(key, value)
      key = 'f129'
      value = (f129.nil? ? nil : f129)
      result.store(key, value)
      key = 'f130'
      value = (f130.nil? ? nil : f130)
      result.store(key, value)
      key = 'f131'
      value = (f131.nil? ? nil : f131)
      result.store(key, value)
      key = 'f132'
      value = (f132.nil? ? nil : f132)
      result.store(key, value)
      key = 'f133'
      value = (f133.nil? ? nil : f133)
      result.store(key, value)
      key = 'f134'
      value = (f134.nil? ? nil : f134)
      result.store(key, value)
      key = 'f135'
      value = (f135.nil? ? nil : f135)
      result.store(key, value)
      key = 'f136'
      value = (f136.nil? ? nil : f136)
      result.store(key, value)
      key = 'f137'
      value = (f137.nil? ? nil : f137)
      result.store(key, value)
      key = 'f138'
      value = (f138.nil? ? nil : f138)
      result.store(key, value)
      key = 'f139'
      value = (f139.nil? ? nil : f139)
      result.store(key, value)
      key = 'f140'
      value = (f140.nil? ? nil : f140)
      result.store(key, value)
      key = 'f141'
      value = (f141.nil? ? nil : f141)
      result.store(key, value)
      key = 'f142'
      value = (f142.nil? ? nil : f142.to_s('F'))
      result.store(key, value)
      key = 'f143'
      value = (f143.nil? ? nil : f143.to_s('F'))
      result.store(key, value)
      key = 'f144'
      value = (f144.nil? ? nil : f144.to_s('F'))
      result.store(key, value)
      key = 'f145'
      value = (f145.nil? ? nil : f145)
      result.store(key, value)
      key = 'f146'
      value = (f146.nil? ? nil : f146)
      result.store(key, value)
      key = 'f147'
      value = (f147.nil? ? nil : f147)
      result.store(key, value)
      key = 'f148'
      value = (f148.nil? ? nil : (f148.to_i * 1000000000 + f148.nsec))
      result.store(key, value)
      key = 'f149'
      value = (f149.nil? ? nil : (f149.to_i * 1000000000 + f149.nsec))
      result.store(key, value)
      key = 'f150'
      value = (f150.nil? ? nil : (f150.to_i * 1000000000 + f150.nsec))
      result.store(key, value)
      key = 'f151'
      value = (f151.nil? ? nil : f151)
      result.store(key, value)
      key = 'f152'
      value = (f152.nil? ? nil : f152)
      result.store(key, value)
      key = 'f153'
      value = (f153.nil? ? nil : f153)
      result.store(key, value)
      key = 'f154'
      value = (f154.nil? ? nil : f154.__to_json_map__)
      result.store(key, value)
      key = 'f155'
      value = (f155.nil? ? nil : f155.__to_json_map__)
      result.store(key, value)
      key = 'f156'
      value = (f156.nil? ? nil : f156.__to_json_map__)
      result.store(key, value)
      key = 'f157'
      value = (f157.nil? ? nil : f157.__to_json_map__)
      result.store(key, value)
      key = 'f158'
      value = (f158.nil? ? nil : f158.__to_json_map__)
      result.store(key, value)
      key = 'f159'
      value = (f159.nil? ? nil : f159.__to_json_map__)
      result.store(key, value)
      key = 'f160'
      value = (f160.nil? ? nil : f160.__to_json_map__)
      result.store(key, value)
      key = 'f161'
      value = (f161.nil? ? nil : f161.__to_json_map__)
      result.store(key, value)
      key = 'f162'
      value = (f162.nil? ? nil : f162.__to_json_map__)
      result.store(key, value)
      key = 'f163'
      value = (f163.nil? ? nil : f163.__to_json_map__)
      result.store(key, value)
      key = 'f164'
      value = (f164.nil? ? nil : f164.__to_json_map__)
      result.store(key, value)
      key = 'f165'
      value = (f165.nil? ? nil : f165.__to_json_map__)
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructOptional.new
      result.method(:initialize_copy).super_method.call(StructOptional.method(:__from_json_map__).super_method.call(json))
      value = json.fetch('f100', nil)
      result.f100 = (value.nil? ? nil : value)
      value = json.fetch('f101', nil)
      result.f101 = (value.nil? ? nil : value)
      value = json.fetch('f102', nil)
      result.f102 = (value.nil? ? nil : value)
      value = json.fetch('f103', nil)
      result.f103 = (value.nil? ? nil : value)
      value = json.fetch('f104', nil)
      result.f104 = (value.nil? ? nil : value)
      value = json.fetch('f105', nil)
      result.f105 = (value.nil? ? nil : value)
      value = json.fetch('f106', nil)
      result.f106 = (value.nil? ? nil : value.chr)
      value = json.fetch('f107', nil)
      result.f107 = (value.nil? ? nil : value.chr)
      value = json.fetch('f108', nil)
      result.f108 = (value.nil? ? nil : value.chr)
      value = json.fetch('f109', nil)
      result.f109 = (value.nil? ? nil : value.chr(Encoding::UTF_8))
      value = json.fetch('f110', nil)
      result.f110 = (value.nil? ? nil : value.chr(Encoding::UTF_8))
      value = json.fetch('f111', nil)
      result.f111 = (value.nil? ? nil : value.chr(Encoding::UTF_8))
      value = json.fetch('f112', nil)
      result.f112 = (value.nil? ? nil : value)
      value = json.fetch('f113', nil)
      result.f113 = (value.nil? ? nil : value)
      value = json.fetch('f114', nil)
      result.f114 = (value.nil? ? nil : value)
      value = json.fetch('f115', nil)
      result.f115 = (value.nil? ? nil : value)
      value = json.fetch('f116', nil)
      result.f116 = (value.nil? ? nil : value)
      value = json.fetch('f117', nil)
      result.f117 = (value.nil? ? nil : value)
      value = json.fetch('f118', nil)
      result.f118 = (value.nil? ? nil : value)
      value = json.fetch('f119', nil)
      result.f119 = (value.nil? ? nil : value)
      value = json.fetch('f120', nil)
      result.f120 = (value.nil? ? nil : value)
      value = json.fetch('f121', nil)
      result.f121 = (value.nil? ? nil : value)
      value = json.fetch('f122', nil)
      result.f122 = (value.nil? ? nil : value)
      value = json.fetch('f123', nil)
      result.f123 = (value.nil? ? nil : value)
      value = json.fetch('f124', nil)
      result.f124 = (value.nil? ? nil : value)
      value = json.fetch('f125', nil)
      result.f125 = (value.nil? ? nil : value)
      value = json.fetch('f126', nil)
      result.f126 = (value.nil? ? nil : value)
      value = json.fetch('f127', nil)
      result.f127 = (value.nil? ? nil : value)
      value = json.fetch('f128', nil)
      result.f128 = (value.nil? ? nil : value)
      value = json.fetch('f129', nil)
      result.f129 = (value.nil? ? nil : value)
      value = json.fetch('f130', nil)
      result.f130 = (value.nil? ? nil : value)
      value = json.fetch('f131', nil)
      result.f131 = (value.nil? ? nil : value)
      value = json.fetch('f132', nil)
      result.f132 = (value.nil? ? nil : value)
      value = json.fetch('f133', nil)
      result.f133 = (value.nil? ? nil : value)
      value = json.fetch('f134', nil)
      result.f134 = (value.nil? ? nil : value)
      value = json.fetch('f135', nil)
      result.f135 = (value.nil? ? nil : value)
      value = json.fetch('f136', nil)
      result.f136 = (value.nil? ? nil : value)
      value = json.fetch('f137', nil)
      result.f137 = (value.nil? ? nil : value)
      value = json.fetch('f138', nil)
      result.f138 = (value.nil? ? nil : value)
      value = json.fetch('f139', nil)
      result.f139 = (value.nil? ? nil : value)
      value = json.fetch('f140', nil)
      result.f140 = (value.nil? ? nil : value)
      value = json.fetch('f141', nil)
      result.f141 = (value.nil? ? nil : value)
      value = json.fetch('f142', nil)
      result.f142 = (value.nil? ? nil : BigDecimal(value))
      value = json.fetch('f143', nil)
      result.f143 = (value.nil? ? nil : BigDecimal(value))
      value = json.fetch('f144', nil)
      result.f144 = (value.nil? ? nil : BigDecimal(value))
      value = json.fetch('f145', nil)
      result.f145 = (value.nil? ? nil : value)
      value = json.fetch('f146', nil)
      result.f146 = (value.nil? ? nil : value)
      value = json.fetch('f147', nil)
      result.f147 = (value.nil? ? nil : value)
      value = json.fetch('f148', nil)
      result.f148 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f149', nil)
      result.f149 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f150', nil)
      result.f150 = (value.nil? ? nil : Time.at(value / 1000000000, (value % 1000000000) / 1000.0).utc)
      value = json.fetch('f151', nil)
      result.f151 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f152', nil)
      result.f152 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f153', nil)
      result.f153 = (value.nil? ? nil : UUIDTools::UUID.parse(value))
      value = json.fetch('f154', nil)
      result.f154 = (value.nil? ? nil : Proto::OrderSide.__from_json_map__(value))
      value = json.fetch('f155', nil)
      result.f155 = (value.nil? ? nil : Proto::OrderSide.__from_json_map__(value))
      value = json.fetch('f156', nil)
      result.f156 = (value.nil? ? nil : Proto::OrderType.__from_json_map__(value))
      value = json.fetch('f157', nil)
      result.f157 = (value.nil? ? nil : Proto::OrderType.__from_json_map__(value))
      value = json.fetch('f158', nil)
      result.f158 = (value.nil? ? nil : Proto::Order.__from_json_map__(value))
      value = json.fetch('f159', nil)
      result.f159 = (value.nil? ? nil : Proto::Order.__from_json_map__(value))
      value = json.fetch('f160', nil)
      result.f160 = (value.nil? ? nil : Proto::Balance.__from_json_map__(value))
      value = json.fetch('f161', nil)
      result.f161 = (value.nil? ? nil : Proto::Balance.__from_json_map__(value))
      value = json.fetch('f162', nil)
      result.f162 = (value.nil? ? nil : Proto::State.__from_json_map__(value))
      value = json.fetch('f163', nil)
      result.f163 = (value.nil? ? nil : Proto::State.__from_json_map__(value))
      value = json.fetch('f164', nil)
      result.f164 = (value.nil? ? nil : Proto::Account.__from_json_map__(value))
      value = json.fetch('f165', nil)
      result.f165 = (value.nil? ? nil : Proto::Account.__from_json_map__(value))
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 111
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructOptional < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_parent = FieldModelStructSimple.new(self.buffer, 4 + 4)
      @_f100 = FBE::FieldModelOptional.new(FBE::FieldModelBool.new(self.buffer, @_parent.fbe_offset + @_parent.fbe_body - 4 - 4), self.buffer, @_parent.fbe_offset + @_parent.fbe_body - 4 - 4)
      @_f101 = FBE::FieldModelOptional.new(FBE::FieldModelBool.new(self.buffer, @_f100.fbe_offset + @_f100.fbe_size), self.buffer, @_f100.fbe_offset + @_f100.fbe_size)
      @_f102 = FBE::FieldModelOptional.new(FBE::FieldModelBool.new(self.buffer, @_f101.fbe_offset + @_f101.fbe_size), self.buffer, @_f101.fbe_offset + @_f101.fbe_size)
      @_f103 = FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f102.fbe_offset + @_f102.fbe_size), self.buffer, @_f102.fbe_offset + @_f102.fbe_size)
      @_f104 = FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f103.fbe_offset + @_f103.fbe_size), self.buffer, @_f103.fbe_offset + @_f103.fbe_size)
      @_f105 = FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f104.fbe_offset + @_f104.fbe_size), self.buffer, @_f104.fbe_offset + @_f104.fbe_size)
      @_f106 = FBE::FieldModelOptional.new(FBE::FieldModelChar.new(self.buffer, @_f105.fbe_offset + @_f105.fbe_size), self.buffer, @_f105.fbe_offset + @_f105.fbe_size)
      @_f107 = FBE::FieldModelOptional.new(FBE::FieldModelChar.new(self.buffer, @_f106.fbe_offset + @_f106.fbe_size), self.buffer, @_f106.fbe_offset + @_f106.fbe_size)
      @_f108 = FBE::FieldModelOptional.new(FBE::FieldModelChar.new(self.buffer, @_f107.fbe_offset + @_f107.fbe_size), self.buffer, @_f107.fbe_offset + @_f107.fbe_size)
      @_f109 = FBE::FieldModelOptional.new(FBE::FieldModelWChar.new(self.buffer, @_f108.fbe_offset + @_f108.fbe_size), self.buffer, @_f108.fbe_offset + @_f108.fbe_size)
      @_f110 = FBE::FieldModelOptional.new(FBE::FieldModelWChar.new(self.buffer, @_f109.fbe_offset + @_f109.fbe_size), self.buffer, @_f109.fbe_offset + @_f109.fbe_size)
      @_f111 = FBE::FieldModelOptional.new(FBE::FieldModelWChar.new(self.buffer, @_f110.fbe_offset + @_f110.fbe_size), self.buffer, @_f110.fbe_offset + @_f110.fbe_size)
      @_f112 = FBE::FieldModelOptional.new(FBE::FieldModelInt8.new(self.buffer, @_f111.fbe_offset + @_f111.fbe_size), self.buffer, @_f111.fbe_offset + @_f111.fbe_size)
      @_f113 = FBE::FieldModelOptional.new(FBE::FieldModelInt8.new(self.buffer, @_f112.fbe_offset + @_f112.fbe_size), self.buffer, @_f112.fbe_offset + @_f112.fbe_size)
      @_f114 = FBE::FieldModelOptional.new(FBE::FieldModelInt8.new(self.buffer, @_f113.fbe_offset + @_f113.fbe_size), self.buffer, @_f113.fbe_offset + @_f113.fbe_size)
      @_f115 = FBE::FieldModelOptional.new(FBE::FieldModelUInt8.new(self.buffer, @_f114.fbe_offset + @_f114.fbe_size), self.buffer, @_f114.fbe_offset + @_f114.fbe_size)
      @_f116 = FBE::FieldModelOptional.new(FBE::FieldModelUInt8.new(self.buffer, @_f115.fbe_offset + @_f115.fbe_size), self.buffer, @_f115.fbe_offset + @_f115.fbe_size)
      @_f117 = FBE::FieldModelOptional.new(FBE::FieldModelUInt8.new(self.buffer, @_f116.fbe_offset + @_f116.fbe_size), self.buffer, @_f116.fbe_offset + @_f116.fbe_size)
      @_f118 = FBE::FieldModelOptional.new(FBE::FieldModelInt16.new(self.buffer, @_f117.fbe_offset + @_f117.fbe_size), self.buffer, @_f117.fbe_offset + @_f117.fbe_size)
      @_f119 = FBE::FieldModelOptional.new(FBE::FieldModelInt16.new(self.buffer, @_f118.fbe_offset + @_f118.fbe_size), self.buffer, @_f118.fbe_offset + @_f118.fbe_size)
      @_f120 = FBE::FieldModelOptional.new(FBE::FieldModelInt16.new(self.buffer, @_f119.fbe_offset + @_f119.fbe_size), self.buffer, @_f119.fbe_offset + @_f119.fbe_size)
      @_f121 = FBE::FieldModelOptional.new(FBE::FieldModelUInt16.new(self.buffer, @_f120.fbe_offset + @_f120.fbe_size), self.buffer, @_f120.fbe_offset + @_f120.fbe_size)
      @_f122 = FBE::FieldModelOptional.new(FBE::FieldModelUInt16.new(self.buffer, @_f121.fbe_offset + @_f121.fbe_size), self.buffer, @_f121.fbe_offset + @_f121.fbe_size)
      @_f123 = FBE::FieldModelOptional.new(FBE::FieldModelUInt16.new(self.buffer, @_f122.fbe_offset + @_f122.fbe_size), self.buffer, @_f122.fbe_offset + @_f122.fbe_size)
      @_f124 = FBE::FieldModelOptional.new(FBE::FieldModelInt32.new(self.buffer, @_f123.fbe_offset + @_f123.fbe_size), self.buffer, @_f123.fbe_offset + @_f123.fbe_size)
      @_f125 = FBE::FieldModelOptional.new(FBE::FieldModelInt32.new(self.buffer, @_f124.fbe_offset + @_f124.fbe_size), self.buffer, @_f124.fbe_offset + @_f124.fbe_size)
      @_f126 = FBE::FieldModelOptional.new(FBE::FieldModelInt32.new(self.buffer, @_f125.fbe_offset + @_f125.fbe_size), self.buffer, @_f125.fbe_offset + @_f125.fbe_size)
      @_f127 = FBE::FieldModelOptional.new(FBE::FieldModelUInt32.new(self.buffer, @_f126.fbe_offset + @_f126.fbe_size), self.buffer, @_f126.fbe_offset + @_f126.fbe_size)
      @_f128 = FBE::FieldModelOptional.new(FBE::FieldModelUInt32.new(self.buffer, @_f127.fbe_offset + @_f127.fbe_size), self.buffer, @_f127.fbe_offset + @_f127.fbe_size)
      @_f129 = FBE::FieldModelOptional.new(FBE::FieldModelUInt32.new(self.buffer, @_f128.fbe_offset + @_f128.fbe_size), self.buffer, @_f128.fbe_offset + @_f128.fbe_size)
      @_f130 = FBE::FieldModelOptional.new(FBE::FieldModelInt64.new(self.buffer, @_f129.fbe_offset + @_f129.fbe_size), self.buffer, @_f129.fbe_offset + @_f129.fbe_size)
      @_f131 = FBE::FieldModelOptional.new(FBE::FieldModelInt64.new(self.buffer, @_f130.fbe_offset + @_f130.fbe_size), self.buffer, @_f130.fbe_offset + @_f130.fbe_size)
      @_f132 = FBE::FieldModelOptional.new(FBE::FieldModelInt64.new(self.buffer, @_f131.fbe_offset + @_f131.fbe_size), self.buffer, @_f131.fbe_offset + @_f131.fbe_size)
      @_f133 = FBE::FieldModelOptional.new(FBE::FieldModelUInt64.new(self.buffer, @_f132.fbe_offset + @_f132.fbe_size), self.buffer, @_f132.fbe_offset + @_f132.fbe_size)
      @_f134 = FBE::FieldModelOptional.new(FBE::FieldModelUInt64.new(self.buffer, @_f133.fbe_offset + @_f133.fbe_size), self.buffer, @_f133.fbe_offset + @_f133.fbe_size)
      @_f135 = FBE::FieldModelOptional.new(FBE::FieldModelUInt64.new(self.buffer, @_f134.fbe_offset + @_f134.fbe_size), self.buffer, @_f134.fbe_offset + @_f134.fbe_size)
      @_f136 = FBE::FieldModelOptional.new(FBE::FieldModelFloat.new(self.buffer, @_f135.fbe_offset + @_f135.fbe_size), self.buffer, @_f135.fbe_offset + @_f135.fbe_size)
      @_f137 = FBE::FieldModelOptional.new(FBE::FieldModelFloat.new(self.buffer, @_f136.fbe_offset + @_f136.fbe_size), self.buffer, @_f136.fbe_offset + @_f136.fbe_size)
      @_f138 = FBE::FieldModelOptional.new(FBE::FieldModelFloat.new(self.buffer, @_f137.fbe_offset + @_f137.fbe_size), self.buffer, @_f137.fbe_offset + @_f137.fbe_size)
      @_f139 = FBE::FieldModelOptional.new(FBE::FieldModelDouble.new(self.buffer, @_f138.fbe_offset + @_f138.fbe_size), self.buffer, @_f138.fbe_offset + @_f138.fbe_size)
      @_f140 = FBE::FieldModelOptional.new(FBE::FieldModelDouble.new(self.buffer, @_f139.fbe_offset + @_f139.fbe_size), self.buffer, @_f139.fbe_offset + @_f139.fbe_size)
      @_f141 = FBE::FieldModelOptional.new(FBE::FieldModelDouble.new(self.buffer, @_f140.fbe_offset + @_f140.fbe_size), self.buffer, @_f140.fbe_offset + @_f140.fbe_size)
      @_f142 = FBE::FieldModelOptional.new(FBE::FieldModelDecimal.new(self.buffer, @_f141.fbe_offset + @_f141.fbe_size), self.buffer, @_f141.fbe_offset + @_f141.fbe_size)
      @_f143 = FBE::FieldModelOptional.new(FBE::FieldModelDecimal.new(self.buffer, @_f142.fbe_offset + @_f142.fbe_size), self.buffer, @_f142.fbe_offset + @_f142.fbe_size)
      @_f144 = FBE::FieldModelOptional.new(FBE::FieldModelDecimal.new(self.buffer, @_f143.fbe_offset + @_f143.fbe_size), self.buffer, @_f143.fbe_offset + @_f143.fbe_size)
      @_f145 = FBE::FieldModelOptional.new(FBE::FieldModelString.new(self.buffer, @_f144.fbe_offset + @_f144.fbe_size), self.buffer, @_f144.fbe_offset + @_f144.fbe_size)
      @_f146 = FBE::FieldModelOptional.new(FBE::FieldModelString.new(self.buffer, @_f145.fbe_offset + @_f145.fbe_size), self.buffer, @_f145.fbe_offset + @_f145.fbe_size)
      @_f147 = FBE::FieldModelOptional.new(FBE::FieldModelString.new(self.buffer, @_f146.fbe_offset + @_f146.fbe_size), self.buffer, @_f146.fbe_offset + @_f146.fbe_size)
      @_f148 = FBE::FieldModelOptional.new(FBE::FieldModelTimestamp.new(self.buffer, @_f147.fbe_offset + @_f147.fbe_size), self.buffer, @_f147.fbe_offset + @_f147.fbe_size)
      @_f149 = FBE::FieldModelOptional.new(FBE::FieldModelTimestamp.new(self.buffer, @_f148.fbe_offset + @_f148.fbe_size), self.buffer, @_f148.fbe_offset + @_f148.fbe_size)
      @_f150 = FBE::FieldModelOptional.new(FBE::FieldModelTimestamp.new(self.buffer, @_f149.fbe_offset + @_f149.fbe_size), self.buffer, @_f149.fbe_offset + @_f149.fbe_size)
      @_f151 = FBE::FieldModelOptional.new(FBE::FieldModelUUID.new(self.buffer, @_f150.fbe_offset + @_f150.fbe_size), self.buffer, @_f150.fbe_offset + @_f150.fbe_size)
      @_f152 = FBE::FieldModelOptional.new(FBE::FieldModelUUID.new(self.buffer, @_f151.fbe_offset + @_f151.fbe_size), self.buffer, @_f151.fbe_offset + @_f151.fbe_size)
      @_f153 = FBE::FieldModelOptional.new(FBE::FieldModelUUID.new(self.buffer, @_f152.fbe_offset + @_f152.fbe_size), self.buffer, @_f152.fbe_offset + @_f152.fbe_size)
      @_f154 = FBE::FieldModelOptional.new(Proto::FieldModelOrderSide.new(self.buffer, @_f153.fbe_offset + @_f153.fbe_size), self.buffer, @_f153.fbe_offset + @_f153.fbe_size)
      @_f155 = FBE::FieldModelOptional.new(Proto::FieldModelOrderSide.new(self.buffer, @_f154.fbe_offset + @_f154.fbe_size), self.buffer, @_f154.fbe_offset + @_f154.fbe_size)
      @_f156 = FBE::FieldModelOptional.new(Proto::FieldModelOrderType.new(self.buffer, @_f155.fbe_offset + @_f155.fbe_size), self.buffer, @_f155.fbe_offset + @_f155.fbe_size)
      @_f157 = FBE::FieldModelOptional.new(Proto::FieldModelOrderType.new(self.buffer, @_f156.fbe_offset + @_f156.fbe_size), self.buffer, @_f156.fbe_offset + @_f156.fbe_size)
      @_f158 = FBE::FieldModelOptional.new(Proto::FieldModelOrder.new(self.buffer, @_f157.fbe_offset + @_f157.fbe_size), self.buffer, @_f157.fbe_offset + @_f157.fbe_size)
      @_f159 = FBE::FieldModelOptional.new(Proto::FieldModelOrder.new(self.buffer, @_f158.fbe_offset + @_f158.fbe_size), self.buffer, @_f158.fbe_offset + @_f158.fbe_size)
      @_f160 = FBE::FieldModelOptional.new(Proto::FieldModelBalance.new(self.buffer, @_f159.fbe_offset + @_f159.fbe_size), self.buffer, @_f159.fbe_offset + @_f159.fbe_size)
      @_f161 = FBE::FieldModelOptional.new(Proto::FieldModelBalance.new(self.buffer, @_f160.fbe_offset + @_f160.fbe_size), self.buffer, @_f160.fbe_offset + @_f160.fbe_size)
      @_f162 = FBE::FieldModelOptional.new(Proto::FieldModelState.new(self.buffer, @_f161.fbe_offset + @_f161.fbe_size), self.buffer, @_f161.fbe_offset + @_f161.fbe_size)
      @_f163 = FBE::FieldModelOptional.new(Proto::FieldModelState.new(self.buffer, @_f162.fbe_offset + @_f162.fbe_size), self.buffer, @_f162.fbe_offset + @_f162.fbe_size)
      @_f164 = FBE::FieldModelOptional.new(Proto::FieldModelAccount.new(self.buffer, @_f163.fbe_offset + @_f163.fbe_size), self.buffer, @_f163.fbe_offset + @_f163.fbe_size)
      @_f165 = FBE::FieldModelOptional.new(Proto::FieldModelAccount.new(self.buffer, @_f164.fbe_offset + @_f164.fbe_size), self.buffer, @_f164.fbe_offset + @_f164.fbe_size)
    end

    def parent
      @_parent
    end

    def f100
      @_f100
    end

    def f101
      @_f101
    end

    def f102
      @_f102
    end

    def f103
      @_f103
    end

    def f104
      @_f104
    end

    def f105
      @_f105
    end

    def f106
      @_f106
    end

    def f107
      @_f107
    end

    def f108
      @_f108
    end

    def f109
      @_f109
    end

    def f110
      @_f110
    end

    def f111
      @_f111
    end

    def f112
      @_f112
    end

    def f113
      @_f113
    end

    def f114
      @_f114
    end

    def f115
      @_f115
    end

    def f116
      @_f116
    end

    def f117
      @_f117
    end

    def f118
      @_f118
    end

    def f119
      @_f119
    end

    def f120
      @_f120
    end

    def f121
      @_f121
    end

    def f122
      @_f122
    end

    def f123
      @_f123
    end

    def f124
      @_f124
    end

    def f125
      @_f125
    end

    def f126
      @_f126
    end

    def f127
      @_f127
    end

    def f128
      @_f128
    end

    def f129
      @_f129
    end

    def f130
      @_f130
    end

    def f131
      @_f131
    end

    def f132
      @_f132
    end

    def f133
      @_f133
    end

    def f134
      @_f134
    end

    def f135
      @_f135
    end

    def f136
      @_f136
    end

    def f137
      @_f137
    end

    def f138
      @_f138
    end

    def f139
      @_f139
    end

    def f140
      @_f140
    end

    def f141
      @_f141
    end

    def f142
      @_f142
    end

    def f143
      @_f143
    end

    def f144
      @_f144
    end

    def f145
      @_f145
    end

    def f146
      @_f146
    end

    def f147
      @_f147
    end

    def f148
      @_f148
    end

    def f149
      @_f149
    end

    def f150
      @_f150
    end

    def f151
      @_f151
    end

    def f152
      @_f152
    end

    def f153
      @_f153
    end

    def f154
      @_f154
    end

    def f155
      @_f155
    end

    def f156
      @_f156
    end

    def f157
      @_f157
    end

    def f158
      @_f158
    end

    def f159
      @_f159
    end

    def f160
      @_f160
    end

    def f161
      @_f161
    end

    def f162
      @_f162
    end

    def f163
      @_f163
    end

    def f164
      @_f164
    end

    def f165
      @_f165
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + parent.fbe_body - 4 - 4 \
        + f100.fbe_size \
        + f101.fbe_size \
        + f102.fbe_size \
        + f103.fbe_size \
        + f104.fbe_size \
        + f105.fbe_size \
        + f106.fbe_size \
        + f107.fbe_size \
        + f108.fbe_size \
        + f109.fbe_size \
        + f110.fbe_size \
        + f111.fbe_size \
        + f112.fbe_size \
        + f113.fbe_size \
        + f114.fbe_size \
        + f115.fbe_size \
        + f116.fbe_size \
        + f117.fbe_size \
        + f118.fbe_size \
        + f119.fbe_size \
        + f120.fbe_size \
        + f121.fbe_size \
        + f122.fbe_size \
        + f123.fbe_size \
        + f124.fbe_size \
        + f125.fbe_size \
        + f126.fbe_size \
        + f127.fbe_size \
        + f128.fbe_size \
        + f129.fbe_size \
        + f130.fbe_size \
        + f131.fbe_size \
        + f132.fbe_size \
        + f133.fbe_size \
        + f134.fbe_size \
        + f135.fbe_size \
        + f136.fbe_size \
        + f137.fbe_size \
        + f138.fbe_size \
        + f139.fbe_size \
        + f140.fbe_size \
        + f141.fbe_size \
        + f142.fbe_size \
        + f143.fbe_size \
        + f144.fbe_size \
        + f145.fbe_size \
        + f146.fbe_size \
        + f147.fbe_size \
        + f148.fbe_size \
        + f149.fbe_size \
        + f150.fbe_size \
        + f151.fbe_size \
        + f152.fbe_size \
        + f153.fbe_size \
        + f154.fbe_size \
        + f155.fbe_size \
        + f156.fbe_size \
        + f157.fbe_size \
        + f158.fbe_size \
        + f159.fbe_size \
        + f160.fbe_size \
        + f161.fbe_size \
        + f162.fbe_size \
        + f163.fbe_size \
        + f164.fbe_size \
        + f165.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + parent.fbe_extra \
        + f100.fbe_extra \
        + f101.fbe_extra \
        + f102.fbe_extra \
        + f103.fbe_extra \
        + f104.fbe_extra \
        + f105.fbe_extra \
        + f106.fbe_extra \
        + f107.fbe_extra \
        + f108.fbe_extra \
        + f109.fbe_extra \
        + f110.fbe_extra \
        + f111.fbe_extra \
        + f112.fbe_extra \
        + f113.fbe_extra \
        + f114.fbe_extra \
        + f115.fbe_extra \
        + f116.fbe_extra \
        + f117.fbe_extra \
        + f118.fbe_extra \
        + f119.fbe_extra \
        + f120.fbe_extra \
        + f121.fbe_extra \
        + f122.fbe_extra \
        + f123.fbe_extra \
        + f124.fbe_extra \
        + f125.fbe_extra \
        + f126.fbe_extra \
        + f127.fbe_extra \
        + f128.fbe_extra \
        + f129.fbe_extra \
        + f130.fbe_extra \
        + f131.fbe_extra \
        + f132.fbe_extra \
        + f133.fbe_extra \
        + f134.fbe_extra \
        + f135.fbe_extra \
        + f136.fbe_extra \
        + f137.fbe_extra \
        + f138.fbe_extra \
        + f139.fbe_extra \
        + f140.fbe_extra \
        + f141.fbe_extra \
        + f142.fbe_extra \
        + f143.fbe_extra \
        + f144.fbe_extra \
        + f145.fbe_extra \
        + f146.fbe_extra \
        + f147.fbe_extra \
        + f148.fbe_extra \
        + f149.fbe_extra \
        + f150.fbe_extra \
        + f151.fbe_extra \
        + f152.fbe_extra \
        + f153.fbe_extra \
        + f154.fbe_extra \
        + f155.fbe_extra \
        + f156.fbe_extra \
        + f157.fbe_extra \
        + f158.fbe_extra \
        + f159.fbe_extra \
        + f160.fbe_extra \
        + f161.fbe_extra \
        + f162.fbe_extra \
        + f163.fbe_extra \
        + f164.fbe_extra \
        + f165.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 111

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + parent.fbe_body - 4 - 4) > fbe_struct_size
        return true
      end
      unless parent.verify_fields(fbe_struct_size)
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += parent.fbe_body - 4 - 4

      if (fbe_current_size + f100.fbe_size) > fbe_struct_size
        return true
      end
      unless f100.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f100.fbe_size

      if (fbe_current_size + f101.fbe_size) > fbe_struct_size
        return true
      end
      unless f101.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f101.fbe_size

      if (fbe_current_size + f102.fbe_size) > fbe_struct_size
        return true
      end
      unless f102.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f102.fbe_size

      if (fbe_current_size + f103.fbe_size) > fbe_struct_size
        return true
      end
      unless f103.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f103.fbe_size

      if (fbe_current_size + f104.fbe_size) > fbe_struct_size
        return true
      end
      unless f104.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f104.fbe_size

      if (fbe_current_size + f105.fbe_size) > fbe_struct_size
        return true
      end
      unless f105.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f105.fbe_size

      if (fbe_current_size + f106.fbe_size) > fbe_struct_size
        return true
      end
      unless f106.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f106.fbe_size

      if (fbe_current_size + f107.fbe_size) > fbe_struct_size
        return true
      end
      unless f107.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f107.fbe_size

      if (fbe_current_size + f108.fbe_size) > fbe_struct_size
        return true
      end
      unless f108.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f108.fbe_size

      if (fbe_current_size + f109.fbe_size) > fbe_struct_size
        return true
      end
      unless f109.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f109.fbe_size

      if (fbe_current_size + f110.fbe_size) > fbe_struct_size
        return true
      end
      unless f110.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f110.fbe_size

      if (fbe_current_size + f111.fbe_size) > fbe_struct_size
        return true
      end
      unless f111.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f111.fbe_size

      if (fbe_current_size + f112.fbe_size) > fbe_struct_size
        return true
      end
      unless f112.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f112.fbe_size

      if (fbe_current_size + f113.fbe_size) > fbe_struct_size
        return true
      end
      unless f113.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f113.fbe_size

      if (fbe_current_size + f114.fbe_size) > fbe_struct_size
        return true
      end
      unless f114.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f114.fbe_size

      if (fbe_current_size + f115.fbe_size) > fbe_struct_size
        return true
      end
      unless f115.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f115.fbe_size

      if (fbe_current_size + f116.fbe_size) > fbe_struct_size
        return true
      end
      unless f116.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f116.fbe_size

      if (fbe_current_size + f117.fbe_size) > fbe_struct_size
        return true
      end
      unless f117.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f117.fbe_size

      if (fbe_current_size + f118.fbe_size) > fbe_struct_size
        return true
      end
      unless f118.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f118.fbe_size

      if (fbe_current_size + f119.fbe_size) > fbe_struct_size
        return true
      end
      unless f119.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f119.fbe_size

      if (fbe_current_size + f120.fbe_size) > fbe_struct_size
        return true
      end
      unless f120.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f120.fbe_size

      if (fbe_current_size + f121.fbe_size) > fbe_struct_size
        return true
      end
      unless f121.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f121.fbe_size

      if (fbe_current_size + f122.fbe_size) > fbe_struct_size
        return true
      end
      unless f122.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f122.fbe_size

      if (fbe_current_size + f123.fbe_size) > fbe_struct_size
        return true
      end
      unless f123.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f123.fbe_size

      if (fbe_current_size + f124.fbe_size) > fbe_struct_size
        return true
      end
      unless f124.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f124.fbe_size

      if (fbe_current_size + f125.fbe_size) > fbe_struct_size
        return true
      end
      unless f125.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f125.fbe_size

      if (fbe_current_size + f126.fbe_size) > fbe_struct_size
        return true
      end
      unless f126.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f126.fbe_size

      if (fbe_current_size + f127.fbe_size) > fbe_struct_size
        return true
      end
      unless f127.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f127.fbe_size

      if (fbe_current_size + f128.fbe_size) > fbe_struct_size
        return true
      end
      unless f128.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f128.fbe_size

      if (fbe_current_size + f129.fbe_size) > fbe_struct_size
        return true
      end
      unless f129.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f129.fbe_size

      if (fbe_current_size + f130.fbe_size) > fbe_struct_size
        return true
      end
      unless f130.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f130.fbe_size

      if (fbe_current_size + f131.fbe_size) > fbe_struct_size
        return true
      end
      unless f131.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f131.fbe_size

      if (fbe_current_size + f132.fbe_size) > fbe_struct_size
        return true
      end
      unless f132.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f132.fbe_size

      if (fbe_current_size + f133.fbe_size) > fbe_struct_size
        return true
      end
      unless f133.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f133.fbe_size

      if (fbe_current_size + f134.fbe_size) > fbe_struct_size
        return true
      end
      unless f134.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f134.fbe_size

      if (fbe_current_size + f135.fbe_size) > fbe_struct_size
        return true
      end
      unless f135.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f135.fbe_size

      if (fbe_current_size + f136.fbe_size) > fbe_struct_size
        return true
      end
      unless f136.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f136.fbe_size

      if (fbe_current_size + f137.fbe_size) > fbe_struct_size
        return true
      end
      unless f137.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f137.fbe_size

      if (fbe_current_size + f138.fbe_size) > fbe_struct_size
        return true
      end
      unless f138.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f138.fbe_size

      if (fbe_current_size + f139.fbe_size) > fbe_struct_size
        return true
      end
      unless f139.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f139.fbe_size

      if (fbe_current_size + f140.fbe_size) > fbe_struct_size
        return true
      end
      unless f140.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f140.fbe_size

      if (fbe_current_size + f141.fbe_size) > fbe_struct_size
        return true
      end
      unless f141.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f141.fbe_size

      if (fbe_current_size + f142.fbe_size) > fbe_struct_size
        return true
      end
      unless f142.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f142.fbe_size

      if (fbe_current_size + f143.fbe_size) > fbe_struct_size
        return true
      end
      unless f143.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f143.fbe_size

      if (fbe_current_size + f144.fbe_size) > fbe_struct_size
        return true
      end
      unless f144.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f144.fbe_size

      if (fbe_current_size + f145.fbe_size) > fbe_struct_size
        return true
      end
      unless f145.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f145.fbe_size

      if (fbe_current_size + f146.fbe_size) > fbe_struct_size
        return true
      end
      unless f146.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f146.fbe_size

      if (fbe_current_size + f147.fbe_size) > fbe_struct_size
        return true
      end
      unless f147.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f147.fbe_size

      if (fbe_current_size + f148.fbe_size) > fbe_struct_size
        return true
      end
      unless f148.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f148.fbe_size

      if (fbe_current_size + f149.fbe_size) > fbe_struct_size
        return true
      end
      unless f149.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f149.fbe_size

      if (fbe_current_size + f150.fbe_size) > fbe_struct_size
        return true
      end
      unless f150.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f150.fbe_size

      if (fbe_current_size + f151.fbe_size) > fbe_struct_size
        return true
      end
      unless f151.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f151.fbe_size

      if (fbe_current_size + f152.fbe_size) > fbe_struct_size
        return true
      end
      unless f152.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f152.fbe_size

      if (fbe_current_size + f153.fbe_size) > fbe_struct_size
        return true
      end
      unless f153.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f153.fbe_size

      if (fbe_current_size + f154.fbe_size) > fbe_struct_size
        return true
      end
      unless f154.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f154.fbe_size

      if (fbe_current_size + f155.fbe_size) > fbe_struct_size
        return true
      end
      unless f155.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f155.fbe_size

      if (fbe_current_size + f156.fbe_size) > fbe_struct_size
        return true
      end
      unless f156.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f156.fbe_size

      if (fbe_current_size + f157.fbe_size) > fbe_struct_size
        return true
      end
      unless f157.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f157.fbe_size

      if (fbe_current_size + f158.fbe_size) > fbe_struct_size
        return true
      end
      unless f158.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f158.fbe_size

      if (fbe_current_size + f159.fbe_size) > fbe_struct_size
        return true
      end
      unless f159.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f159.fbe_size

      if (fbe_current_size + f160.fbe_size) > fbe_struct_size
        return true
      end
      unless f160.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f160.fbe_size

      if (fbe_current_size + f161.fbe_size) > fbe_struct_size
        return true
      end
      unless f161.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f161.fbe_size

      if (fbe_current_size + f162.fbe_size) > fbe_struct_size
        return true
      end
      unless f162.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f162.fbe_size

      if (fbe_current_size + f163.fbe_size) > fbe_struct_size
        return true
      end
      unless f163.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f163.fbe_size

      if (fbe_current_size + f164.fbe_size) > fbe_struct_size
        return true
      end
      unless f164.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f164.fbe_size

      if (fbe_current_size + f165.fbe_size) > fbe_struct_size
        return true
      end
      unless f165.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f165.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructOptional.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + parent.fbe_body - 4 - 4) <= fbe_struct_size
        parent.get_fields(fbe_value, fbe_struct_size)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += parent.fbe_body - 4 - 4

      if (fbe_current_size + f100.fbe_size) <= fbe_struct_size
        fbe_value.f100 = f100.get
      else
        fbe_value.f100 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f100.fbe_size

      if (fbe_current_size + f101.fbe_size) <= fbe_struct_size
        fbe_value.f101 = f101.get(true)
      else
        fbe_value.f101 = true
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f101.fbe_size

      if (fbe_current_size + f102.fbe_size) <= fbe_struct_size
        fbe_value.f102 = f102.get(nil)
      else
        fbe_value.f102 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f102.fbe_size

      if (fbe_current_size + f103.fbe_size) <= fbe_struct_size
        fbe_value.f103 = f103.get
      else
        fbe_value.f103 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f103.fbe_size

      if (fbe_current_size + f104.fbe_size) <= fbe_struct_size
        fbe_value.f104 = f104.get(255)
      else
        fbe_value.f104 = 255
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f104.fbe_size

      if (fbe_current_size + f105.fbe_size) <= fbe_struct_size
        fbe_value.f105 = f105.get(nil)
      else
        fbe_value.f105 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f105.fbe_size

      if (fbe_current_size + f106.fbe_size) <= fbe_struct_size
        fbe_value.f106 = f106.get
      else
        fbe_value.f106 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f106.fbe_size

      if (fbe_current_size + f107.fbe_size) <= fbe_struct_size
        fbe_value.f107 = f107.get('!')
      else
        fbe_value.f107 = '!'
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f107.fbe_size

      if (fbe_current_size + f108.fbe_size) <= fbe_struct_size
        fbe_value.f108 = f108.get(nil)
      else
        fbe_value.f108 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f108.fbe_size

      if (fbe_current_size + f109.fbe_size) <= fbe_struct_size
        fbe_value.f109 = f109.get
      else
        fbe_value.f109 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f109.fbe_size

      if (fbe_current_size + f110.fbe_size) <= fbe_struct_size
        fbe_value.f110 = f110.get(0x0444.chr(Encoding::UTF_8))
      else
        fbe_value.f110 = 0x0444.chr(Encoding::UTF_8)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f110.fbe_size

      if (fbe_current_size + f111.fbe_size) <= fbe_struct_size
        fbe_value.f111 = f111.get(nil)
      else
        fbe_value.f111 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f111.fbe_size

      if (fbe_current_size + f112.fbe_size) <= fbe_struct_size
        fbe_value.f112 = f112.get
      else
        fbe_value.f112 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f112.fbe_size

      if (fbe_current_size + f113.fbe_size) <= fbe_struct_size
        fbe_value.f113 = f113.get(127)
      else
        fbe_value.f113 = 127
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f113.fbe_size

      if (fbe_current_size + f114.fbe_size) <= fbe_struct_size
        fbe_value.f114 = f114.get(nil)
      else
        fbe_value.f114 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f114.fbe_size

      if (fbe_current_size + f115.fbe_size) <= fbe_struct_size
        fbe_value.f115 = f115.get
      else
        fbe_value.f115 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f115.fbe_size

      if (fbe_current_size + f116.fbe_size) <= fbe_struct_size
        fbe_value.f116 = f116.get(255)
      else
        fbe_value.f116 = 255
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f116.fbe_size

      if (fbe_current_size + f117.fbe_size) <= fbe_struct_size
        fbe_value.f117 = f117.get(nil)
      else
        fbe_value.f117 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f117.fbe_size

      if (fbe_current_size + f118.fbe_size) <= fbe_struct_size
        fbe_value.f118 = f118.get
      else
        fbe_value.f118 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f118.fbe_size

      if (fbe_current_size + f119.fbe_size) <= fbe_struct_size
        fbe_value.f119 = f119.get(32767)
      else
        fbe_value.f119 = 32767
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f119.fbe_size

      if (fbe_current_size + f120.fbe_size) <= fbe_struct_size
        fbe_value.f120 = f120.get(nil)
      else
        fbe_value.f120 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f120.fbe_size

      if (fbe_current_size + f121.fbe_size) <= fbe_struct_size
        fbe_value.f121 = f121.get
      else
        fbe_value.f121 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f121.fbe_size

      if (fbe_current_size + f122.fbe_size) <= fbe_struct_size
        fbe_value.f122 = f122.get(65535)
      else
        fbe_value.f122 = 65535
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f122.fbe_size

      if (fbe_current_size + f123.fbe_size) <= fbe_struct_size
        fbe_value.f123 = f123.get(nil)
      else
        fbe_value.f123 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f123.fbe_size

      if (fbe_current_size + f124.fbe_size) <= fbe_struct_size
        fbe_value.f124 = f124.get
      else
        fbe_value.f124 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f124.fbe_size

      if (fbe_current_size + f125.fbe_size) <= fbe_struct_size
        fbe_value.f125 = f125.get(2147483647)
      else
        fbe_value.f125 = 2147483647
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f125.fbe_size

      if (fbe_current_size + f126.fbe_size) <= fbe_struct_size
        fbe_value.f126 = f126.get(nil)
      else
        fbe_value.f126 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f126.fbe_size

      if (fbe_current_size + f127.fbe_size) <= fbe_struct_size
        fbe_value.f127 = f127.get
      else
        fbe_value.f127 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f127.fbe_size

      if (fbe_current_size + f128.fbe_size) <= fbe_struct_size
        fbe_value.f128 = f128.get(4294967295)
      else
        fbe_value.f128 = 4294967295
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f128.fbe_size

      if (fbe_current_size + f129.fbe_size) <= fbe_struct_size
        fbe_value.f129 = f129.get(nil)
      else
        fbe_value.f129 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f129.fbe_size

      if (fbe_current_size + f130.fbe_size) <= fbe_struct_size
        fbe_value.f130 = f130.get
      else
        fbe_value.f130 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f130.fbe_size

      if (fbe_current_size + f131.fbe_size) <= fbe_struct_size
        fbe_value.f131 = f131.get(9223372036854775807)
      else
        fbe_value.f131 = 9223372036854775807
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f131.fbe_size

      if (fbe_current_size + f132.fbe_size) <= fbe_struct_size
        fbe_value.f132 = f132.get(nil)
      else
        fbe_value.f132 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f132.fbe_size

      if (fbe_current_size + f133.fbe_size) <= fbe_struct_size
        fbe_value.f133 = f133.get
      else
        fbe_value.f133 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f133.fbe_size

      if (fbe_current_size + f134.fbe_size) <= fbe_struct_size
        fbe_value.f134 = f134.get(18446744073709551615)
      else
        fbe_value.f134 = 18446744073709551615
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f134.fbe_size

      if (fbe_current_size + f135.fbe_size) <= fbe_struct_size
        fbe_value.f135 = f135.get(nil)
      else
        fbe_value.f135 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f135.fbe_size

      if (fbe_current_size + f136.fbe_size) <= fbe_struct_size
        fbe_value.f136 = f136.get
      else
        fbe_value.f136 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f136.fbe_size

      if (fbe_current_size + f137.fbe_size) <= fbe_struct_size
        fbe_value.f137 = f137.get(123.456)
      else
        fbe_value.f137 = 123.456
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f137.fbe_size

      if (fbe_current_size + f138.fbe_size) <= fbe_struct_size
        fbe_value.f138 = f138.get(nil)
      else
        fbe_value.f138 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f138.fbe_size

      if (fbe_current_size + f139.fbe_size) <= fbe_struct_size
        fbe_value.f139 = f139.get
      else
        fbe_value.f139 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f139.fbe_size

      if (fbe_current_size + f140.fbe_size) <= fbe_struct_size
        fbe_value.f140 = f140.get(-123.456e+123)
      else
        fbe_value.f140 = -123.456e+123
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f140.fbe_size

      if (fbe_current_size + f141.fbe_size) <= fbe_struct_size
        fbe_value.f141 = f141.get(nil)
      else
        fbe_value.f141 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f141.fbe_size

      if (fbe_current_size + f142.fbe_size) <= fbe_struct_size
        fbe_value.f142 = f142.get
      else
        fbe_value.f142 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f142.fbe_size

      if (fbe_current_size + f143.fbe_size) <= fbe_struct_size
        fbe_value.f143 = f143.get(BigDecimal('123456.123456'))
      else
        fbe_value.f143 = BigDecimal('123456.123456')
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f143.fbe_size

      if (fbe_current_size + f144.fbe_size) <= fbe_struct_size
        fbe_value.f144 = f144.get(nil)
      else
        fbe_value.f144 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f144.fbe_size

      if (fbe_current_size + f145.fbe_size) <= fbe_struct_size
        fbe_value.f145 = f145.get
      else
        fbe_value.f145 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f145.fbe_size

      if (fbe_current_size + f146.fbe_size) <= fbe_struct_size
        fbe_value.f146 = f146.get("Initial string!")
      else
        fbe_value.f146 = "Initial string!"
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f146.fbe_size

      if (fbe_current_size + f147.fbe_size) <= fbe_struct_size
        fbe_value.f147 = f147.get(nil)
      else
        fbe_value.f147 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f147.fbe_size

      if (fbe_current_size + f148.fbe_size) <= fbe_struct_size
        fbe_value.f148 = f148.get
      else
        fbe_value.f148 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f148.fbe_size

      if (fbe_current_size + f149.fbe_size) <= fbe_struct_size
        fbe_value.f149 = f149.get(Time.now.utc)
      else
        fbe_value.f149 = Time.now.utc
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f149.fbe_size

      if (fbe_current_size + f150.fbe_size) <= fbe_struct_size
        fbe_value.f150 = f150.get(nil)
      else
        fbe_value.f150 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f150.fbe_size

      if (fbe_current_size + f151.fbe_size) <= fbe_struct_size
        fbe_value.f151 = f151.get
      else
        fbe_value.f151 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f151.fbe_size

      if (fbe_current_size + f152.fbe_size) <= fbe_struct_size
        fbe_value.f152 = f152.get(UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000"))
      else
        fbe_value.f152 = UUIDTools::UUID.parse("123e4567-e89b-12d3-a456-426655440000")
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f152.fbe_size

      if (fbe_current_size + f153.fbe_size) <= fbe_struct_size
        fbe_value.f153 = f153.get(nil)
      else
        fbe_value.f153 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f153.fbe_size

      if (fbe_current_size + f154.fbe_size) <= fbe_struct_size
        fbe_value.f154 = f154.get
      else
        fbe_value.f154 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f154.fbe_size

      if (fbe_current_size + f155.fbe_size) <= fbe_struct_size
        fbe_value.f155 = f155.get(nil)
      else
        fbe_value.f155 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f155.fbe_size

      if (fbe_current_size + f156.fbe_size) <= fbe_struct_size
        fbe_value.f156 = f156.get
      else
        fbe_value.f156 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f156.fbe_size

      if (fbe_current_size + f157.fbe_size) <= fbe_struct_size
        fbe_value.f157 = f157.get(nil)
      else
        fbe_value.f157 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f157.fbe_size

      if (fbe_current_size + f158.fbe_size) <= fbe_struct_size
        fbe_value.f158 = f158.get
      else
        fbe_value.f158 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f158.fbe_size

      if (fbe_current_size + f159.fbe_size) <= fbe_struct_size
        fbe_value.f159 = f159.get(nil)
      else
        fbe_value.f159 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f159.fbe_size

      if (fbe_current_size + f160.fbe_size) <= fbe_struct_size
        fbe_value.f160 = f160.get
      else
        fbe_value.f160 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f160.fbe_size

      if (fbe_current_size + f161.fbe_size) <= fbe_struct_size
        fbe_value.f161 = f161.get(nil)
      else
        fbe_value.f161 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f161.fbe_size

      if (fbe_current_size + f162.fbe_size) <= fbe_struct_size
        fbe_value.f162 = f162.get
      else
        fbe_value.f162 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f162.fbe_size

      if (fbe_current_size + f163.fbe_size) <= fbe_struct_size
        fbe_value.f163 = f163.get(nil)
      else
        fbe_value.f163 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f163.fbe_size

      if (fbe_current_size + f164.fbe_size) <= fbe_struct_size
        fbe_value.f164 = f164.get
      else
        fbe_value.f164 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f164.fbe_size

      if (fbe_current_size + f165.fbe_size) <= fbe_struct_size
        fbe_value.f165 = f165.get(nil)
      else
        fbe_value.f165 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f165.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      parent.set_fields(fbe_value)
      f100.set(fbe_value.f100)
      f101.set(fbe_value.f101)
      f102.set(fbe_value.f102)
      f103.set(fbe_value.f103)
      f104.set(fbe_value.f104)
      f105.set(fbe_value.f105)
      f106.set(fbe_value.f106)
      f107.set(fbe_value.f107)
      f108.set(fbe_value.f108)
      f109.set(fbe_value.f109)
      f110.set(fbe_value.f110)
      f111.set(fbe_value.f111)
      f112.set(fbe_value.f112)
      f113.set(fbe_value.f113)
      f114.set(fbe_value.f114)
      f115.set(fbe_value.f115)
      f116.set(fbe_value.f116)
      f117.set(fbe_value.f117)
      f118.set(fbe_value.f118)
      f119.set(fbe_value.f119)
      f120.set(fbe_value.f120)
      f121.set(fbe_value.f121)
      f122.set(fbe_value.f122)
      f123.set(fbe_value.f123)
      f124.set(fbe_value.f124)
      f125.set(fbe_value.f125)
      f126.set(fbe_value.f126)
      f127.set(fbe_value.f127)
      f128.set(fbe_value.f128)
      f129.set(fbe_value.f129)
      f130.set(fbe_value.f130)
      f131.set(fbe_value.f131)
      f132.set(fbe_value.f132)
      f133.set(fbe_value.f133)
      f134.set(fbe_value.f134)
      f135.set(fbe_value.f135)
      f136.set(fbe_value.f136)
      f137.set(fbe_value.f137)
      f138.set(fbe_value.f138)
      f139.set(fbe_value.f139)
      f140.set(fbe_value.f140)
      f141.set(fbe_value.f141)
      f142.set(fbe_value.f142)
      f143.set(fbe_value.f143)
      f144.set(fbe_value.f144)
      f145.set(fbe_value.f145)
      f146.set(fbe_value.f146)
      f147.set(fbe_value.f147)
      f148.set(fbe_value.f148)
      f149.set(fbe_value.f149)
      f150.set(fbe_value.f150)
      f151.set(fbe_value.f151)
      f152.set(fbe_value.f152)
      f153.set(fbe_value.f153)
      f154.set(fbe_value.f154)
      f155.set(fbe_value.f155)
      f156.set(fbe_value.f156)
      f157.set(fbe_value.f157)
      f158.set(fbe_value.f158)
      f159.set(fbe_value.f159)
      f160.set(fbe_value.f160)
      f161.set(fbe_value.f161)
      f162.set(fbe_value.f162)
      f163.set(fbe_value.f163)
      f164.set(fbe_value.f164)
      f165.set(fbe_value.f165)
    end
  end

  # Fast Binary Encoding StructOptional model
  class StructOptionalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructOptional.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructOptional::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructOptional.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructOptional.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructOptional.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructOptional < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_parent = FinalModelStructSimple.new(self.buffer, 0)
      @_f100 = FBE::FinalModelOptional.new(FBE::FinalModelBool.new(self.buffer, 0), self.buffer, 0)
      @_f101 = FBE::FinalModelOptional.new(FBE::FinalModelBool.new(self.buffer, 0), self.buffer, 0)
      @_f102 = FBE::FinalModelOptional.new(FBE::FinalModelBool.new(self.buffer, 0), self.buffer, 0)
      @_f103 = FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f104 = FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f105 = FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f106 = FBE::FinalModelOptional.new(FBE::FinalModelChar.new(self.buffer, 0), self.buffer, 0)
      @_f107 = FBE::FinalModelOptional.new(FBE::FinalModelChar.new(self.buffer, 0), self.buffer, 0)
      @_f108 = FBE::FinalModelOptional.new(FBE::FinalModelChar.new(self.buffer, 0), self.buffer, 0)
      @_f109 = FBE::FinalModelOptional.new(FBE::FinalModelWChar.new(self.buffer, 0), self.buffer, 0)
      @_f110 = FBE::FinalModelOptional.new(FBE::FinalModelWChar.new(self.buffer, 0), self.buffer, 0)
      @_f111 = FBE::FinalModelOptional.new(FBE::FinalModelWChar.new(self.buffer, 0), self.buffer, 0)
      @_f112 = FBE::FinalModelOptional.new(FBE::FinalModelInt8.new(self.buffer, 0), self.buffer, 0)
      @_f113 = FBE::FinalModelOptional.new(FBE::FinalModelInt8.new(self.buffer, 0), self.buffer, 0)
      @_f114 = FBE::FinalModelOptional.new(FBE::FinalModelInt8.new(self.buffer, 0), self.buffer, 0)
      @_f115 = FBE::FinalModelOptional.new(FBE::FinalModelUInt8.new(self.buffer, 0), self.buffer, 0)
      @_f116 = FBE::FinalModelOptional.new(FBE::FinalModelUInt8.new(self.buffer, 0), self.buffer, 0)
      @_f117 = FBE::FinalModelOptional.new(FBE::FinalModelUInt8.new(self.buffer, 0), self.buffer, 0)
      @_f118 = FBE::FinalModelOptional.new(FBE::FinalModelInt16.new(self.buffer, 0), self.buffer, 0)
      @_f119 = FBE::FinalModelOptional.new(FBE::FinalModelInt16.new(self.buffer, 0), self.buffer, 0)
      @_f120 = FBE::FinalModelOptional.new(FBE::FinalModelInt16.new(self.buffer, 0), self.buffer, 0)
      @_f121 = FBE::FinalModelOptional.new(FBE::FinalModelUInt16.new(self.buffer, 0), self.buffer, 0)
      @_f122 = FBE::FinalModelOptional.new(FBE::FinalModelUInt16.new(self.buffer, 0), self.buffer, 0)
      @_f123 = FBE::FinalModelOptional.new(FBE::FinalModelUInt16.new(self.buffer, 0), self.buffer, 0)
      @_f124 = FBE::FinalModelOptional.new(FBE::FinalModelInt32.new(self.buffer, 0), self.buffer, 0)
      @_f125 = FBE::FinalModelOptional.new(FBE::FinalModelInt32.new(self.buffer, 0), self.buffer, 0)
      @_f126 = FBE::FinalModelOptional.new(FBE::FinalModelInt32.new(self.buffer, 0), self.buffer, 0)
      @_f127 = FBE::FinalModelOptional.new(FBE::FinalModelUInt32.new(self.buffer, 0), self.buffer, 0)
      @_f128 = FBE::FinalModelOptional.new(FBE::FinalModelUInt32.new(self.buffer, 0), self.buffer, 0)
      @_f129 = FBE::FinalModelOptional.new(FBE::FinalModelUInt32.new(self.buffer, 0), self.buffer, 0)
      @_f130 = FBE::FinalModelOptional.new(FBE::FinalModelInt64.new(self.buffer, 0), self.buffer, 0)
      @_f131 = FBE::FinalModelOptional.new(FBE::FinalModelInt64.new(self.buffer, 0), self.buffer, 0)
      @_f132 = FBE::FinalModelOptional.new(FBE::FinalModelInt64.new(self.buffer, 0), self.buffer, 0)
      @_f133 = FBE::FinalModelOptional.new(FBE::FinalModelUInt64.new(self.buffer, 0), self.buffer, 0)
      @_f134 = FBE::FinalModelOptional.new(FBE::FinalModelUInt64.new(self.buffer, 0), self.buffer, 0)
      @_f135 = FBE::FinalModelOptional.new(FBE::FinalModelUInt64.new(self.buffer, 0), self.buffer, 0)
      @_f136 = FBE::FinalModelOptional.new(FBE::FinalModelFloat.new(self.buffer, 0), self.buffer, 0)
      @_f137 = FBE::FinalModelOptional.new(FBE::FinalModelFloat.new(self.buffer, 0), self.buffer, 0)
      @_f138 = FBE::FinalModelOptional.new(FBE::FinalModelFloat.new(self.buffer, 0), self.buffer, 0)
      @_f139 = FBE::FinalModelOptional.new(FBE::FinalModelDouble.new(self.buffer, 0), self.buffer, 0)
      @_f140 = FBE::FinalModelOptional.new(FBE::FinalModelDouble.new(self.buffer, 0), self.buffer, 0)
      @_f141 = FBE::FinalModelOptional.new(FBE::FinalModelDouble.new(self.buffer, 0), self.buffer, 0)
      @_f142 = FBE::FinalModelOptional.new(FBE::FinalModelDecimal.new(self.buffer, 0), self.buffer, 0)
      @_f143 = FBE::FinalModelOptional.new(FBE::FinalModelDecimal.new(self.buffer, 0), self.buffer, 0)
      @_f144 = FBE::FinalModelOptional.new(FBE::FinalModelDecimal.new(self.buffer, 0), self.buffer, 0)
      @_f145 = FBE::FinalModelOptional.new(FBE::FinalModelString.new(self.buffer, 0), self.buffer, 0)
      @_f146 = FBE::FinalModelOptional.new(FBE::FinalModelString.new(self.buffer, 0), self.buffer, 0)
      @_f147 = FBE::FinalModelOptional.new(FBE::FinalModelString.new(self.buffer, 0), self.buffer, 0)
      @_f148 = FBE::FinalModelOptional.new(FBE::FinalModelTimestamp.new(self.buffer, 0), self.buffer, 0)
      @_f149 = FBE::FinalModelOptional.new(FBE::FinalModelTimestamp.new(self.buffer, 0), self.buffer, 0)
      @_f150 = FBE::FinalModelOptional.new(FBE::FinalModelTimestamp.new(self.buffer, 0), self.buffer, 0)
      @_f151 = FBE::FinalModelOptional.new(FBE::FinalModelUUID.new(self.buffer, 0), self.buffer, 0)
      @_f152 = FBE::FinalModelOptional.new(FBE::FinalModelUUID.new(self.buffer, 0), self.buffer, 0)
      @_f153 = FBE::FinalModelOptional.new(FBE::FinalModelUUID.new(self.buffer, 0), self.buffer, 0)
      @_f154 = FBE::FinalModelOptional.new(Proto::FinalModelOrderSide.new(self.buffer, 0), self.buffer, 0)
      @_f155 = FBE::FinalModelOptional.new(Proto::FinalModelOrderSide.new(self.buffer, 0), self.buffer, 0)
      @_f156 = FBE::FinalModelOptional.new(Proto::FinalModelOrderType.new(self.buffer, 0), self.buffer, 0)
      @_f157 = FBE::FinalModelOptional.new(Proto::FinalModelOrderType.new(self.buffer, 0), self.buffer, 0)
      @_f158 = FBE::FinalModelOptional.new(Proto::FinalModelOrder.new(self.buffer, 0), self.buffer, 0)
      @_f159 = FBE::FinalModelOptional.new(Proto::FinalModelOrder.new(self.buffer, 0), self.buffer, 0)
      @_f160 = FBE::FinalModelOptional.new(Proto::FinalModelBalance.new(self.buffer, 0), self.buffer, 0)
      @_f161 = FBE::FinalModelOptional.new(Proto::FinalModelBalance.new(self.buffer, 0), self.buffer, 0)
      @_f162 = FBE::FinalModelOptional.new(Proto::FinalModelState.new(self.buffer, 0), self.buffer, 0)
      @_f163 = FBE::FinalModelOptional.new(Proto::FinalModelState.new(self.buffer, 0), self.buffer, 0)
      @_f164 = FBE::FinalModelOptional.new(Proto::FinalModelAccount.new(self.buffer, 0), self.buffer, 0)
      @_f165 = FBE::FinalModelOptional.new(Proto::FinalModelAccount.new(self.buffer, 0), self.buffer, 0)
    end

    def parent
      @_parent
    end

    def f100
      @_f100
    end

    def f101
      @_f101
    end

    def f102
      @_f102
    end

    def f103
      @_f103
    end

    def f104
      @_f104
    end

    def f105
      @_f105
    end

    def f106
      @_f106
    end

    def f107
      @_f107
    end

    def f108
      @_f108
    end

    def f109
      @_f109
    end

    def f110
      @_f110
    end

    def f111
      @_f111
    end

    def f112
      @_f112
    end

    def f113
      @_f113
    end

    def f114
      @_f114
    end

    def f115
      @_f115
    end

    def f116
      @_f116
    end

    def f117
      @_f117
    end

    def f118
      @_f118
    end

    def f119
      @_f119
    end

    def f120
      @_f120
    end

    def f121
      @_f121
    end

    def f122
      @_f122
    end

    def f123
      @_f123
    end

    def f124
      @_f124
    end

    def f125
      @_f125
    end

    def f126
      @_f126
    end

    def f127
      @_f127
    end

    def f128
      @_f128
    end

    def f129
      @_f129
    end

    def f130
      @_f130
    end

    def f131
      @_f131
    end

    def f132
      @_f132
    end

    def f133
      @_f133
    end

    def f134
      @_f134
    end

    def f135
      @_f135
    end

    def f136
      @_f136
    end

    def f137
      @_f137
    end

    def f138
      @_f138
    end

    def f139
      @_f139
    end

    def f140
      @_f140
    end

    def f141
      @_f141
    end

    def f142
      @_f142
    end

    def f143
      @_f143
    end

    def f144
      @_f144
    end

    def f145
      @_f145
    end

    def f146
      @_f146
    end

    def f147
      @_f147
    end

    def f148
      @_f148
    end

    def f149
      @_f149
    end

    def f150
      @_f150
    end

    def f151
      @_f151
    end

    def f152
      @_f152
    end

    def f153
      @_f153
    end

    def f154
      @_f154
    end

    def f155
      @_f155
    end

    def f156
      @_f156
    end

    def f157
      @_f157
    end

    def f158
      @_f158
    end

    def f159
      @_f159
    end

    def f160
      @_f160
    end

    def f161
      @_f161
    end

    def f162
      @_f162
    end

    def f163
      @_f163
    end

    def f164
      @_f164
    end

    def f165
      @_f165
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + parent.fbe_allocation_size(fbe_value) \
        + f100.fbe_allocation_size(fbe_value.f100) \
        + f101.fbe_allocation_size(fbe_value.f101) \
        + f102.fbe_allocation_size(fbe_value.f102) \
        + f103.fbe_allocation_size(fbe_value.f103) \
        + f104.fbe_allocation_size(fbe_value.f104) \
        + f105.fbe_allocation_size(fbe_value.f105) \
        + f106.fbe_allocation_size(fbe_value.f106) \
        + f107.fbe_allocation_size(fbe_value.f107) \
        + f108.fbe_allocation_size(fbe_value.f108) \
        + f109.fbe_allocation_size(fbe_value.f109) \
        + f110.fbe_allocation_size(fbe_value.f110) \
        + f111.fbe_allocation_size(fbe_value.f111) \
        + f112.fbe_allocation_size(fbe_value.f112) \
        + f113.fbe_allocation_size(fbe_value.f113) \
        + f114.fbe_allocation_size(fbe_value.f114) \
        + f115.fbe_allocation_size(fbe_value.f115) \
        + f116.fbe_allocation_size(fbe_value.f116) \
        + f117.fbe_allocation_size(fbe_value.f117) \
        + f118.fbe_allocation_size(fbe_value.f118) \
        + f119.fbe_allocation_size(fbe_value.f119) \
        + f120.fbe_allocation_size(fbe_value.f120) \
        + f121.fbe_allocation_size(fbe_value.f121) \
        + f122.fbe_allocation_size(fbe_value.f122) \
        + f123.fbe_allocation_size(fbe_value.f123) \
        + f124.fbe_allocation_size(fbe_value.f124) \
        + f125.fbe_allocation_size(fbe_value.f125) \
        + f126.fbe_allocation_size(fbe_value.f126) \
        + f127.fbe_allocation_size(fbe_value.f127) \
        + f128.fbe_allocation_size(fbe_value.f128) \
        + f129.fbe_allocation_size(fbe_value.f129) \
        + f130.fbe_allocation_size(fbe_value.f130) \
        + f131.fbe_allocation_size(fbe_value.f131) \
        + f132.fbe_allocation_size(fbe_value.f132) \
        + f133.fbe_allocation_size(fbe_value.f133) \
        + f134.fbe_allocation_size(fbe_value.f134) \
        + f135.fbe_allocation_size(fbe_value.f135) \
        + f136.fbe_allocation_size(fbe_value.f136) \
        + f137.fbe_allocation_size(fbe_value.f137) \
        + f138.fbe_allocation_size(fbe_value.f138) \
        + f139.fbe_allocation_size(fbe_value.f139) \
        + f140.fbe_allocation_size(fbe_value.f140) \
        + f141.fbe_allocation_size(fbe_value.f141) \
        + f142.fbe_allocation_size(fbe_value.f142) \
        + f143.fbe_allocation_size(fbe_value.f143) \
        + f144.fbe_allocation_size(fbe_value.f144) \
        + f145.fbe_allocation_size(fbe_value.f145) \
        + f146.fbe_allocation_size(fbe_value.f146) \
        + f147.fbe_allocation_size(fbe_value.f147) \
        + f148.fbe_allocation_size(fbe_value.f148) \
        + f149.fbe_allocation_size(fbe_value.f149) \
        + f150.fbe_allocation_size(fbe_value.f150) \
        + f151.fbe_allocation_size(fbe_value.f151) \
        + f152.fbe_allocation_size(fbe_value.f152) \
        + f153.fbe_allocation_size(fbe_value.f153) \
        + f154.fbe_allocation_size(fbe_value.f154) \
        + f155.fbe_allocation_size(fbe_value.f155) \
        + f156.fbe_allocation_size(fbe_value.f156) \
        + f157.fbe_allocation_size(fbe_value.f157) \
        + f158.fbe_allocation_size(fbe_value.f158) \
        + f159.fbe_allocation_size(fbe_value.f159) \
        + f160.fbe_allocation_size(fbe_value.f160) \
        + f161.fbe_allocation_size(fbe_value.f161) \
        + f162.fbe_allocation_size(fbe_value.f162) \
        + f163.fbe_allocation_size(fbe_value.f163) \
        + f164.fbe_allocation_size(fbe_value.f164) \
        + f165.fbe_allocation_size(fbe_value.f165) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 111

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      parent.fbe_offset = fbe_current_offset
      fbe_field_size = parent.verify_fields
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f100.fbe_offset = fbe_current_offset
      fbe_field_size = f100.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f101.fbe_offset = fbe_current_offset
      fbe_field_size = f101.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f102.fbe_offset = fbe_current_offset
      fbe_field_size = f102.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f103.fbe_offset = fbe_current_offset
      fbe_field_size = f103.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f104.fbe_offset = fbe_current_offset
      fbe_field_size = f104.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f105.fbe_offset = fbe_current_offset
      fbe_field_size = f105.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f106.fbe_offset = fbe_current_offset
      fbe_field_size = f106.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f107.fbe_offset = fbe_current_offset
      fbe_field_size = f107.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f108.fbe_offset = fbe_current_offset
      fbe_field_size = f108.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f109.fbe_offset = fbe_current_offset
      fbe_field_size = f109.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f110.fbe_offset = fbe_current_offset
      fbe_field_size = f110.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f111.fbe_offset = fbe_current_offset
      fbe_field_size = f111.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f112.fbe_offset = fbe_current_offset
      fbe_field_size = f112.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f113.fbe_offset = fbe_current_offset
      fbe_field_size = f113.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f114.fbe_offset = fbe_current_offset
      fbe_field_size = f114.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f115.fbe_offset = fbe_current_offset
      fbe_field_size = f115.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f116.fbe_offset = fbe_current_offset
      fbe_field_size = f116.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f117.fbe_offset = fbe_current_offset
      fbe_field_size = f117.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f118.fbe_offset = fbe_current_offset
      fbe_field_size = f118.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f119.fbe_offset = fbe_current_offset
      fbe_field_size = f119.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f120.fbe_offset = fbe_current_offset
      fbe_field_size = f120.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f121.fbe_offset = fbe_current_offset
      fbe_field_size = f121.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f122.fbe_offset = fbe_current_offset
      fbe_field_size = f122.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f123.fbe_offset = fbe_current_offset
      fbe_field_size = f123.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f124.fbe_offset = fbe_current_offset
      fbe_field_size = f124.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f125.fbe_offset = fbe_current_offset
      fbe_field_size = f125.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f126.fbe_offset = fbe_current_offset
      fbe_field_size = f126.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f127.fbe_offset = fbe_current_offset
      fbe_field_size = f127.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f128.fbe_offset = fbe_current_offset
      fbe_field_size = f128.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f129.fbe_offset = fbe_current_offset
      fbe_field_size = f129.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f130.fbe_offset = fbe_current_offset
      fbe_field_size = f130.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f131.fbe_offset = fbe_current_offset
      fbe_field_size = f131.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f132.fbe_offset = fbe_current_offset
      fbe_field_size = f132.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f133.fbe_offset = fbe_current_offset
      fbe_field_size = f133.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f134.fbe_offset = fbe_current_offset
      fbe_field_size = f134.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f135.fbe_offset = fbe_current_offset
      fbe_field_size = f135.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f136.fbe_offset = fbe_current_offset
      fbe_field_size = f136.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f137.fbe_offset = fbe_current_offset
      fbe_field_size = f137.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f138.fbe_offset = fbe_current_offset
      fbe_field_size = f138.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f139.fbe_offset = fbe_current_offset
      fbe_field_size = f139.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f140.fbe_offset = fbe_current_offset
      fbe_field_size = f140.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f141.fbe_offset = fbe_current_offset
      fbe_field_size = f141.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f142.fbe_offset = fbe_current_offset
      fbe_field_size = f142.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f143.fbe_offset = fbe_current_offset
      fbe_field_size = f143.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f144.fbe_offset = fbe_current_offset
      fbe_field_size = f144.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f145.fbe_offset = fbe_current_offset
      fbe_field_size = f145.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f146.fbe_offset = fbe_current_offset
      fbe_field_size = f146.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f147.fbe_offset = fbe_current_offset
      fbe_field_size = f147.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f148.fbe_offset = fbe_current_offset
      fbe_field_size = f148.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f149.fbe_offset = fbe_current_offset
      fbe_field_size = f149.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f150.fbe_offset = fbe_current_offset
      fbe_field_size = f150.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f151.fbe_offset = fbe_current_offset
      fbe_field_size = f151.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f152.fbe_offset = fbe_current_offset
      fbe_field_size = f152.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f153.fbe_offset = fbe_current_offset
      fbe_field_size = f153.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f154.fbe_offset = fbe_current_offset
      fbe_field_size = f154.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f155.fbe_offset = fbe_current_offset
      fbe_field_size = f155.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f156.fbe_offset = fbe_current_offset
      fbe_field_size = f156.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f157.fbe_offset = fbe_current_offset
      fbe_field_size = f157.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f158.fbe_offset = fbe_current_offset
      fbe_field_size = f158.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f159.fbe_offset = fbe_current_offset
      fbe_field_size = f159.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f160.fbe_offset = fbe_current_offset
      fbe_field_size = f160.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f161.fbe_offset = fbe_current_offset
      fbe_field_size = f161.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f162.fbe_offset = fbe_current_offset
      fbe_field_size = f162.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f163.fbe_offset = fbe_current_offset
      fbe_field_size = f163.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f164.fbe_offset = fbe_current_offset
      fbe_field_size = f164.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f165.fbe_offset = fbe_current_offset
      fbe_field_size = f165.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructOptional.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      parent.fbe_offset = fbe_current_offset
      fbe_result = parent.get_fields(fbe_value)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result
      fbe_current_size += fbe_result

      f100.fbe_offset = fbe_current_offset
      fbe_result = f100.get
      fbe_value.f100 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f101.fbe_offset = fbe_current_offset
      fbe_result = f101.get
      fbe_value.f101 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f102.fbe_offset = fbe_current_offset
      fbe_result = f102.get
      fbe_value.f102 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f103.fbe_offset = fbe_current_offset
      fbe_result = f103.get
      fbe_value.f103 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f104.fbe_offset = fbe_current_offset
      fbe_result = f104.get
      fbe_value.f104 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f105.fbe_offset = fbe_current_offset
      fbe_result = f105.get
      fbe_value.f105 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f106.fbe_offset = fbe_current_offset
      fbe_result = f106.get
      fbe_value.f106 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f107.fbe_offset = fbe_current_offset
      fbe_result = f107.get
      fbe_value.f107 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f108.fbe_offset = fbe_current_offset
      fbe_result = f108.get
      fbe_value.f108 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f109.fbe_offset = fbe_current_offset
      fbe_result = f109.get
      fbe_value.f109 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f110.fbe_offset = fbe_current_offset
      fbe_result = f110.get
      fbe_value.f110 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f111.fbe_offset = fbe_current_offset
      fbe_result = f111.get
      fbe_value.f111 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f112.fbe_offset = fbe_current_offset
      fbe_result = f112.get
      fbe_value.f112 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f113.fbe_offset = fbe_current_offset
      fbe_result = f113.get
      fbe_value.f113 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f114.fbe_offset = fbe_current_offset
      fbe_result = f114.get
      fbe_value.f114 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f115.fbe_offset = fbe_current_offset
      fbe_result = f115.get
      fbe_value.f115 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f116.fbe_offset = fbe_current_offset
      fbe_result = f116.get
      fbe_value.f116 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f117.fbe_offset = fbe_current_offset
      fbe_result = f117.get
      fbe_value.f117 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f118.fbe_offset = fbe_current_offset
      fbe_result = f118.get
      fbe_value.f118 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f119.fbe_offset = fbe_current_offset
      fbe_result = f119.get
      fbe_value.f119 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f120.fbe_offset = fbe_current_offset
      fbe_result = f120.get
      fbe_value.f120 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f121.fbe_offset = fbe_current_offset
      fbe_result = f121.get
      fbe_value.f121 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f122.fbe_offset = fbe_current_offset
      fbe_result = f122.get
      fbe_value.f122 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f123.fbe_offset = fbe_current_offset
      fbe_result = f123.get
      fbe_value.f123 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f124.fbe_offset = fbe_current_offset
      fbe_result = f124.get
      fbe_value.f124 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f125.fbe_offset = fbe_current_offset
      fbe_result = f125.get
      fbe_value.f125 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f126.fbe_offset = fbe_current_offset
      fbe_result = f126.get
      fbe_value.f126 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f127.fbe_offset = fbe_current_offset
      fbe_result = f127.get
      fbe_value.f127 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f128.fbe_offset = fbe_current_offset
      fbe_result = f128.get
      fbe_value.f128 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f129.fbe_offset = fbe_current_offset
      fbe_result = f129.get
      fbe_value.f129 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f130.fbe_offset = fbe_current_offset
      fbe_result = f130.get
      fbe_value.f130 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f131.fbe_offset = fbe_current_offset
      fbe_result = f131.get
      fbe_value.f131 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f132.fbe_offset = fbe_current_offset
      fbe_result = f132.get
      fbe_value.f132 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f133.fbe_offset = fbe_current_offset
      fbe_result = f133.get
      fbe_value.f133 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f134.fbe_offset = fbe_current_offset
      fbe_result = f134.get
      fbe_value.f134 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f135.fbe_offset = fbe_current_offset
      fbe_result = f135.get
      fbe_value.f135 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f136.fbe_offset = fbe_current_offset
      fbe_result = f136.get
      fbe_value.f136 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f137.fbe_offset = fbe_current_offset
      fbe_result = f137.get
      fbe_value.f137 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f138.fbe_offset = fbe_current_offset
      fbe_result = f138.get
      fbe_value.f138 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f139.fbe_offset = fbe_current_offset
      fbe_result = f139.get
      fbe_value.f139 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f140.fbe_offset = fbe_current_offset
      fbe_result = f140.get
      fbe_value.f140 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f141.fbe_offset = fbe_current_offset
      fbe_result = f141.get
      fbe_value.f141 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f142.fbe_offset = fbe_current_offset
      fbe_result = f142.get
      fbe_value.f142 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f143.fbe_offset = fbe_current_offset
      fbe_result = f143.get
      fbe_value.f143 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f144.fbe_offset = fbe_current_offset
      fbe_result = f144.get
      fbe_value.f144 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f145.fbe_offset = fbe_current_offset
      fbe_result = f145.get
      fbe_value.f145 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f146.fbe_offset = fbe_current_offset
      fbe_result = f146.get
      fbe_value.f146 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f147.fbe_offset = fbe_current_offset
      fbe_result = f147.get
      fbe_value.f147 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f148.fbe_offset = fbe_current_offset
      fbe_result = f148.get
      fbe_value.f148 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f149.fbe_offset = fbe_current_offset
      fbe_result = f149.get
      fbe_value.f149 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f150.fbe_offset = fbe_current_offset
      fbe_result = f150.get
      fbe_value.f150 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f151.fbe_offset = fbe_current_offset
      fbe_result = f151.get
      fbe_value.f151 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f152.fbe_offset = fbe_current_offset
      fbe_result = f152.get
      fbe_value.f152 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f153.fbe_offset = fbe_current_offset
      fbe_result = f153.get
      fbe_value.f153 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f154.fbe_offset = fbe_current_offset
      fbe_result = f154.get
      fbe_value.f154 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f155.fbe_offset = fbe_current_offset
      fbe_result = f155.get
      fbe_value.f155 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f156.fbe_offset = fbe_current_offset
      fbe_result = f156.get
      fbe_value.f156 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f157.fbe_offset = fbe_current_offset
      fbe_result = f157.get
      fbe_value.f157 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f158.fbe_offset = fbe_current_offset
      fbe_result = f158.get
      fbe_value.f158 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f159.fbe_offset = fbe_current_offset
      fbe_result = f159.get
      fbe_value.f159 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f160.fbe_offset = fbe_current_offset
      fbe_result = f160.get
      fbe_value.f160 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f161.fbe_offset = fbe_current_offset
      fbe_result = f161.get
      fbe_value.f161 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f162.fbe_offset = fbe_current_offset
      fbe_result = f162.get
      fbe_value.f162 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f163.fbe_offset = fbe_current_offset
      fbe_result = f163.get
      fbe_value.f163 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f164.fbe_offset = fbe_current_offset
      fbe_result = f164.get
      fbe_value.f164 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f165.fbe_offset = fbe_current_offset
      fbe_result = f165.get
      fbe_value.f165 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      parent.fbe_offset = fbe_current_offset
      fbe_field_size = parent.set_fields(fbe_value)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f100.fbe_offset = fbe_current_offset
      fbe_field_size = f100.set(fbe_value.f100)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f101.fbe_offset = fbe_current_offset
      fbe_field_size = f101.set(fbe_value.f101)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f102.fbe_offset = fbe_current_offset
      fbe_field_size = f102.set(fbe_value.f102)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f103.fbe_offset = fbe_current_offset
      fbe_field_size = f103.set(fbe_value.f103)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f104.fbe_offset = fbe_current_offset
      fbe_field_size = f104.set(fbe_value.f104)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f105.fbe_offset = fbe_current_offset
      fbe_field_size = f105.set(fbe_value.f105)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f106.fbe_offset = fbe_current_offset
      fbe_field_size = f106.set(fbe_value.f106)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f107.fbe_offset = fbe_current_offset
      fbe_field_size = f107.set(fbe_value.f107)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f108.fbe_offset = fbe_current_offset
      fbe_field_size = f108.set(fbe_value.f108)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f109.fbe_offset = fbe_current_offset
      fbe_field_size = f109.set(fbe_value.f109)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f110.fbe_offset = fbe_current_offset
      fbe_field_size = f110.set(fbe_value.f110)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f111.fbe_offset = fbe_current_offset
      fbe_field_size = f111.set(fbe_value.f111)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f112.fbe_offset = fbe_current_offset
      fbe_field_size = f112.set(fbe_value.f112)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f113.fbe_offset = fbe_current_offset
      fbe_field_size = f113.set(fbe_value.f113)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f114.fbe_offset = fbe_current_offset
      fbe_field_size = f114.set(fbe_value.f114)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f115.fbe_offset = fbe_current_offset
      fbe_field_size = f115.set(fbe_value.f115)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f116.fbe_offset = fbe_current_offset
      fbe_field_size = f116.set(fbe_value.f116)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f117.fbe_offset = fbe_current_offset
      fbe_field_size = f117.set(fbe_value.f117)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f118.fbe_offset = fbe_current_offset
      fbe_field_size = f118.set(fbe_value.f118)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f119.fbe_offset = fbe_current_offset
      fbe_field_size = f119.set(fbe_value.f119)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f120.fbe_offset = fbe_current_offset
      fbe_field_size = f120.set(fbe_value.f120)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f121.fbe_offset = fbe_current_offset
      fbe_field_size = f121.set(fbe_value.f121)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f122.fbe_offset = fbe_current_offset
      fbe_field_size = f122.set(fbe_value.f122)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f123.fbe_offset = fbe_current_offset
      fbe_field_size = f123.set(fbe_value.f123)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f124.fbe_offset = fbe_current_offset
      fbe_field_size = f124.set(fbe_value.f124)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f125.fbe_offset = fbe_current_offset
      fbe_field_size = f125.set(fbe_value.f125)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f126.fbe_offset = fbe_current_offset
      fbe_field_size = f126.set(fbe_value.f126)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f127.fbe_offset = fbe_current_offset
      fbe_field_size = f127.set(fbe_value.f127)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f128.fbe_offset = fbe_current_offset
      fbe_field_size = f128.set(fbe_value.f128)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f129.fbe_offset = fbe_current_offset
      fbe_field_size = f129.set(fbe_value.f129)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f130.fbe_offset = fbe_current_offset
      fbe_field_size = f130.set(fbe_value.f130)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f131.fbe_offset = fbe_current_offset
      fbe_field_size = f131.set(fbe_value.f131)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f132.fbe_offset = fbe_current_offset
      fbe_field_size = f132.set(fbe_value.f132)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f133.fbe_offset = fbe_current_offset
      fbe_field_size = f133.set(fbe_value.f133)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f134.fbe_offset = fbe_current_offset
      fbe_field_size = f134.set(fbe_value.f134)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f135.fbe_offset = fbe_current_offset
      fbe_field_size = f135.set(fbe_value.f135)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f136.fbe_offset = fbe_current_offset
      fbe_field_size = f136.set(fbe_value.f136)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f137.fbe_offset = fbe_current_offset
      fbe_field_size = f137.set(fbe_value.f137)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f138.fbe_offset = fbe_current_offset
      fbe_field_size = f138.set(fbe_value.f138)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f139.fbe_offset = fbe_current_offset
      fbe_field_size = f139.set(fbe_value.f139)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f140.fbe_offset = fbe_current_offset
      fbe_field_size = f140.set(fbe_value.f140)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f141.fbe_offset = fbe_current_offset
      fbe_field_size = f141.set(fbe_value.f141)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f142.fbe_offset = fbe_current_offset
      fbe_field_size = f142.set(fbe_value.f142)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f143.fbe_offset = fbe_current_offset
      fbe_field_size = f143.set(fbe_value.f143)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f144.fbe_offset = fbe_current_offset
      fbe_field_size = f144.set(fbe_value.f144)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f145.fbe_offset = fbe_current_offset
      fbe_field_size = f145.set(fbe_value.f145)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f146.fbe_offset = fbe_current_offset
      fbe_field_size = f146.set(fbe_value.f146)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f147.fbe_offset = fbe_current_offset
      fbe_field_size = f147.set(fbe_value.f147)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f148.fbe_offset = fbe_current_offset
      fbe_field_size = f148.set(fbe_value.f148)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f149.fbe_offset = fbe_current_offset
      fbe_field_size = f149.set(fbe_value.f149)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f150.fbe_offset = fbe_current_offset
      fbe_field_size = f150.set(fbe_value.f150)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f151.fbe_offset = fbe_current_offset
      fbe_field_size = f151.set(fbe_value.f151)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f152.fbe_offset = fbe_current_offset
      fbe_field_size = f152.set(fbe_value.f152)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f153.fbe_offset = fbe_current_offset
      fbe_field_size = f153.set(fbe_value.f153)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f154.fbe_offset = fbe_current_offset
      fbe_field_size = f154.set(fbe_value.f154)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f155.fbe_offset = fbe_current_offset
      fbe_field_size = f155.set(fbe_value.f155)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f156.fbe_offset = fbe_current_offset
      fbe_field_size = f156.set(fbe_value.f156)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f157.fbe_offset = fbe_current_offset
      fbe_field_size = f157.set(fbe_value.f157)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f158.fbe_offset = fbe_current_offset
      fbe_field_size = f158.set(fbe_value.f158)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f159.fbe_offset = fbe_current_offset
      fbe_field_size = f159.set(fbe_value.f159)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f160.fbe_offset = fbe_current_offset
      fbe_field_size = f160.set(fbe_value.f160)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f161.fbe_offset = fbe_current_offset
      fbe_field_size = f161.set(fbe_value.f161)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f162.fbe_offset = fbe_current_offset
      fbe_field_size = f162.set(fbe_value.f162)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f163.fbe_offset = fbe_current_offset
      fbe_field_size = f163.set(fbe_value.f163)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f164.fbe_offset = fbe_current_offset
      fbe_field_size = f164.set(fbe_value.f164)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f165.fbe_offset = fbe_current_offset
      fbe_field_size = f165.set(fbe_value.f165)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructOptional final model
  class StructOptionalFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructOptional.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructOptional::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructOptional.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructOptional.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructOptional.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructNested < StructOptional
    include Comparable

    attr_accessor :f1000
    attr_accessor :f1001
    attr_accessor :f1002
    attr_accessor :f1003
    attr_accessor :f1004
    attr_accessor :f1005
    attr_accessor :f1006
    attr_accessor :f1007
    attr_accessor :f1008
    attr_accessor :f1009
    attr_accessor :f1010
    attr_accessor :f1011

    def initialize(parent = StructOptional.new, f1000 = EnumSimple.new, f1001 = nil, f1002 = EnumTyped.ENUM_VALUE_2, f1003 = nil, f1004 = FlagsSimple.new, f1005 = nil, f1006 = FlagsTyped.FLAG_VALUE_2 | FlagsTyped.FLAG_VALUE_4 | FlagsTyped.FLAG_VALUE_6, f1007 = nil, f1008 = StructSimple.new, f1009 = nil, f1010 = StructOptional.new, f1011 = nil)
      method(:initialize_copy).super_method.call(parent)
      @f1000 = f1000
      @f1001 = f1001
      @f1002 = f1002
      @f1003 = f1003
      @f1004 = f1004
      @f1005 = f1005
      @f1006 = f1006
      @f1007 = f1007
      @f1008 = f1008
      @f1009 = f1009
      @f1010 = f1010
      @f1011 = f1011
    end

    def initialize_copy(other)
      super(other)
      @f1000 = other.f1000
      @f1001 = other.f1001
      @f1002 = other.f1002
      @f1003 = other.f1003
      @f1004 = other.f1004
      @f1005 = other.f1005
      @f1006 = other.f1006
      @f1007 = other.f1007
      @f1008 = other.f1008
      @f1009 = other.f1009
      @f1010 = other.f1010
      @f1011 = other.f1011
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructNested)

      # noinspection RubyUnusedLocalVariable
      result = 0
      result = super
      if result != 0
        return result
      end
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      result.push(super)
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructNested('
      result << super
      result << ',f1000='
      if !@f1000.nil?
        result << @f1000.to_s
      else
        result << 'null'
      end
      result << ',f1001='
      if !@f1001.nil?
        result << @f1001.to_s
      else
        result << 'null'
      end
      result << ',f1002='
      if !@f1002.nil?
        result << @f1002.to_s
      else
        result << 'null'
      end
      result << ',f1003='
      if !@f1003.nil?
        result << @f1003.to_s
      else
        result << 'null'
      end
      result << ',f1004='
      if !@f1004.nil?
        result << @f1004.to_s
      else
        result << 'null'
      end
      result << ',f1005='
      if !@f1005.nil?
        result << @f1005.to_s
      else
        result << 'null'
      end
      result << ',f1006='
      if !@f1006.nil?
        result << @f1006.to_s
      else
        result << 'null'
      end
      result << ',f1007='
      if !@f1007.nil?
        result << @f1007.to_s
      else
        result << 'null'
      end
      result << ',f1008='
      if !@f1008.nil?
        result << @f1008.to_s
      else
        result << 'null'
      end
      result << ',f1009='
      if !@f1009.nil?
        result << @f1009.to_s
      else
        result << 'null'
      end
      result << ',f1010='
      if !@f1010.nil?
        result << @f1010.to_s
      else
        result << 'null'
      end
      result << ',f1011='
      if !@f1011.nil?
        result << @f1011.to_s
      else
        result << 'null'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructNestedModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructNestedModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      result.update(super)
      key = 'f1000'
      value = (f1000.nil? ? nil : f1000.__to_json_map__)
      result.store(key, value)
      key = 'f1001'
      value = (f1001.nil? ? nil : f1001.__to_json_map__)
      result.store(key, value)
      key = 'f1002'
      value = (f1002.nil? ? nil : f1002.__to_json_map__)
      result.store(key, value)
      key = 'f1003'
      value = (f1003.nil? ? nil : f1003.__to_json_map__)
      result.store(key, value)
      key = 'f1004'
      value = (f1004.nil? ? nil : f1004.__to_json_map__)
      result.store(key, value)
      key = 'f1005'
      value = (f1005.nil? ? nil : f1005.__to_json_map__)
      result.store(key, value)
      key = 'f1006'
      value = (f1006.nil? ? nil : f1006.__to_json_map__)
      result.store(key, value)
      key = 'f1007'
      value = (f1007.nil? ? nil : f1007.__to_json_map__)
      result.store(key, value)
      key = 'f1008'
      value = (f1008.nil? ? nil : f1008.__to_json_map__)
      result.store(key, value)
      key = 'f1009'
      value = (f1009.nil? ? nil : f1009.__to_json_map__)
      result.store(key, value)
      key = 'f1010'
      value = (f1010.nil? ? nil : f1010.__to_json_map__)
      result.store(key, value)
      key = 'f1011'
      value = (f1011.nil? ? nil : f1011.__to_json_map__)
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructNested.new
      result.method(:initialize_copy).super_method.call(StructNested.method(:__from_json_map__).super_method.call(json))
      value = json.fetch('f1000', nil)
      result.f1000 = (value.nil? ? nil : EnumSimple.__from_json_map__(value))
      value = json.fetch('f1001', nil)
      result.f1001 = (value.nil? ? nil : EnumSimple.__from_json_map__(value))
      value = json.fetch('f1002', nil)
      result.f1002 = (value.nil? ? nil : EnumTyped.__from_json_map__(value))
      value = json.fetch('f1003', nil)
      result.f1003 = (value.nil? ? nil : EnumTyped.__from_json_map__(value))
      value = json.fetch('f1004', nil)
      result.f1004 = (value.nil? ? nil : FlagsSimple.__from_json_map__(value))
      value = json.fetch('f1005', nil)
      result.f1005 = (value.nil? ? nil : FlagsSimple.__from_json_map__(value))
      value = json.fetch('f1006', nil)
      result.f1006 = (value.nil? ? nil : FlagsTyped.__from_json_map__(value))
      value = json.fetch('f1007', nil)
      result.f1007 = (value.nil? ? nil : FlagsTyped.__from_json_map__(value))
      value = json.fetch('f1008', nil)
      result.f1008 = (value.nil? ? nil : StructSimple.__from_json_map__(value))
      value = json.fetch('f1009', nil)
      result.f1009 = (value.nil? ? nil : StructSimple.__from_json_map__(value))
      value = json.fetch('f1010', nil)
      result.f1010 = (value.nil? ? nil : StructOptional.__from_json_map__(value))
      value = json.fetch('f1011', nil)
      result.f1011 = (value.nil? ? nil : StructOptional.__from_json_map__(value))
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 112
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructNested < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_parent = FieldModelStructOptional.new(self.buffer, 4 + 4)
      @_f1000 = FieldModelEnumSimple.new(self.buffer, @_parent.fbe_offset + @_parent.fbe_body - 4 - 4)
      @_f1001 = FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f1000.fbe_offset + @_f1000.fbe_size), self.buffer, @_f1000.fbe_offset + @_f1000.fbe_size)
      @_f1002 = FieldModelEnumTyped.new(self.buffer, @_f1001.fbe_offset + @_f1001.fbe_size)
      @_f1003 = FBE::FieldModelOptional.new(FieldModelEnumTyped.new(self.buffer, @_f1002.fbe_offset + @_f1002.fbe_size), self.buffer, @_f1002.fbe_offset + @_f1002.fbe_size)
      @_f1004 = FieldModelFlagsSimple.new(self.buffer, @_f1003.fbe_offset + @_f1003.fbe_size)
      @_f1005 = FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f1004.fbe_offset + @_f1004.fbe_size), self.buffer, @_f1004.fbe_offset + @_f1004.fbe_size)
      @_f1006 = FieldModelFlagsTyped.new(self.buffer, @_f1005.fbe_offset + @_f1005.fbe_size)
      @_f1007 = FBE::FieldModelOptional.new(FieldModelFlagsTyped.new(self.buffer, @_f1006.fbe_offset + @_f1006.fbe_size), self.buffer, @_f1006.fbe_offset + @_f1006.fbe_size)
      @_f1008 = FieldModelStructSimple.new(self.buffer, @_f1007.fbe_offset + @_f1007.fbe_size)
      @_f1009 = FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f1008.fbe_offset + @_f1008.fbe_size), self.buffer, @_f1008.fbe_offset + @_f1008.fbe_size)
      @_f1010 = FieldModelStructOptional.new(self.buffer, @_f1009.fbe_offset + @_f1009.fbe_size)
      @_f1011 = FBE::FieldModelOptional.new(FieldModelStructOptional.new(self.buffer, @_f1010.fbe_offset + @_f1010.fbe_size), self.buffer, @_f1010.fbe_offset + @_f1010.fbe_size)
    end

    def parent
      @_parent
    end

    def f1000
      @_f1000
    end

    def f1001
      @_f1001
    end

    def f1002
      @_f1002
    end

    def f1003
      @_f1003
    end

    def f1004
      @_f1004
    end

    def f1005
      @_f1005
    end

    def f1006
      @_f1006
    end

    def f1007
      @_f1007
    end

    def f1008
      @_f1008
    end

    def f1009
      @_f1009
    end

    def f1010
      @_f1010
    end

    def f1011
      @_f1011
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + parent.fbe_body - 4 - 4 \
        + f1000.fbe_size \
        + f1001.fbe_size \
        + f1002.fbe_size \
        + f1003.fbe_size \
        + f1004.fbe_size \
        + f1005.fbe_size \
        + f1006.fbe_size \
        + f1007.fbe_size \
        + f1008.fbe_size \
        + f1009.fbe_size \
        + f1010.fbe_size \
        + f1011.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + parent.fbe_extra \
        + f1000.fbe_extra \
        + f1001.fbe_extra \
        + f1002.fbe_extra \
        + f1003.fbe_extra \
        + f1004.fbe_extra \
        + f1005.fbe_extra \
        + f1006.fbe_extra \
        + f1007.fbe_extra \
        + f1008.fbe_extra \
        + f1009.fbe_extra \
        + f1010.fbe_extra \
        + f1011.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 112

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + parent.fbe_body - 4 - 4) > fbe_struct_size
        return true
      end
      unless parent.verify_fields(fbe_struct_size)
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += parent.fbe_body - 4 - 4

      if (fbe_current_size + f1000.fbe_size) > fbe_struct_size
        return true
      end
      unless f1000.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1000.fbe_size

      if (fbe_current_size + f1001.fbe_size) > fbe_struct_size
        return true
      end
      unless f1001.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1001.fbe_size

      if (fbe_current_size + f1002.fbe_size) > fbe_struct_size
        return true
      end
      unless f1002.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1002.fbe_size

      if (fbe_current_size + f1003.fbe_size) > fbe_struct_size
        return true
      end
      unless f1003.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1003.fbe_size

      if (fbe_current_size + f1004.fbe_size) > fbe_struct_size
        return true
      end
      unless f1004.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1004.fbe_size

      if (fbe_current_size + f1005.fbe_size) > fbe_struct_size
        return true
      end
      unless f1005.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1005.fbe_size

      if (fbe_current_size + f1006.fbe_size) > fbe_struct_size
        return true
      end
      unless f1006.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1006.fbe_size

      if (fbe_current_size + f1007.fbe_size) > fbe_struct_size
        return true
      end
      unless f1007.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1007.fbe_size

      if (fbe_current_size + f1008.fbe_size) > fbe_struct_size
        return true
      end
      unless f1008.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1008.fbe_size

      if (fbe_current_size + f1009.fbe_size) > fbe_struct_size
        return true
      end
      unless f1009.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1009.fbe_size

      if (fbe_current_size + f1010.fbe_size) > fbe_struct_size
        return true
      end
      unless f1010.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1010.fbe_size

      if (fbe_current_size + f1011.fbe_size) > fbe_struct_size
        return true
      end
      unless f1011.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1011.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructNested.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + parent.fbe_body - 4 - 4) <= fbe_struct_size
        parent.get_fields(fbe_value, fbe_struct_size)
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += parent.fbe_body - 4 - 4

      if (fbe_current_size + f1000.fbe_size) <= fbe_struct_size
        fbe_value.f1000 = f1000.get
      else
        fbe_value.f1000 = EnumSimple.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1000.fbe_size

      if (fbe_current_size + f1001.fbe_size) <= fbe_struct_size
        fbe_value.f1001 = f1001.get
      else
        fbe_value.f1001 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1001.fbe_size

      if (fbe_current_size + f1002.fbe_size) <= fbe_struct_size
        fbe_value.f1002 = f1002.get(EnumTyped.ENUM_VALUE_2)
      else
        fbe_value.f1002 = EnumTyped.ENUM_VALUE_2
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1002.fbe_size

      if (fbe_current_size + f1003.fbe_size) <= fbe_struct_size
        fbe_value.f1003 = f1003.get(nil)
      else
        fbe_value.f1003 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1003.fbe_size

      if (fbe_current_size + f1004.fbe_size) <= fbe_struct_size
        fbe_value.f1004 = f1004.get
      else
        fbe_value.f1004 = FlagsSimple.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1004.fbe_size

      if (fbe_current_size + f1005.fbe_size) <= fbe_struct_size
        fbe_value.f1005 = f1005.get
      else
        fbe_value.f1005 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1005.fbe_size

      if (fbe_current_size + f1006.fbe_size) <= fbe_struct_size
        fbe_value.f1006 = f1006.get(FlagsTyped.FLAG_VALUE_2 | FlagsTyped.FLAG_VALUE_4 | FlagsTyped.FLAG_VALUE_6)
      else
        fbe_value.f1006 = FlagsTyped.FLAG_VALUE_2 | FlagsTyped.FLAG_VALUE_4 | FlagsTyped.FLAG_VALUE_6
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1006.fbe_size

      if (fbe_current_size + f1007.fbe_size) <= fbe_struct_size
        fbe_value.f1007 = f1007.get(nil)
      else
        fbe_value.f1007 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1007.fbe_size

      if (fbe_current_size + f1008.fbe_size) <= fbe_struct_size
        fbe_value.f1008 = f1008.get
      else
        fbe_value.f1008 = StructSimple.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1008.fbe_size

      if (fbe_current_size + f1009.fbe_size) <= fbe_struct_size
        fbe_value.f1009 = f1009.get
      else
        fbe_value.f1009 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1009.fbe_size

      if (fbe_current_size + f1010.fbe_size) <= fbe_struct_size
        fbe_value.f1010 = f1010.get
      else
        fbe_value.f1010 = StructOptional.new
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1010.fbe_size

      if (fbe_current_size + f1011.fbe_size) <= fbe_struct_size
        fbe_value.f1011 = f1011.get(nil)
      else
        fbe_value.f1011 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1011.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      parent.set_fields(fbe_value)
      f1000.set(fbe_value.f1000)
      f1001.set(fbe_value.f1001)
      f1002.set(fbe_value.f1002)
      f1003.set(fbe_value.f1003)
      f1004.set(fbe_value.f1004)
      f1005.set(fbe_value.f1005)
      f1006.set(fbe_value.f1006)
      f1007.set(fbe_value.f1007)
      f1008.set(fbe_value.f1008)
      f1009.set(fbe_value.f1009)
      f1010.set(fbe_value.f1010)
      f1011.set(fbe_value.f1011)
    end
  end

  # Fast Binary Encoding StructNested model
  class StructNestedModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructNested.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructNested::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructNested.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructNested.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructNested.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructNested < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_parent = FinalModelStructOptional.new(self.buffer, 0)
      @_f1000 = FinalModelEnumSimple.new(self.buffer, 0)
      @_f1001 = FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f1002 = FinalModelEnumTyped.new(self.buffer, 0)
      @_f1003 = FBE::FinalModelOptional.new(FinalModelEnumTyped.new(self.buffer, 0), self.buffer, 0)
      @_f1004 = FinalModelFlagsSimple.new(self.buffer, 0)
      @_f1005 = FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f1006 = FinalModelFlagsTyped.new(self.buffer, 0)
      @_f1007 = FBE::FinalModelOptional.new(FinalModelFlagsTyped.new(self.buffer, 0), self.buffer, 0)
      @_f1008 = FinalModelStructSimple.new(self.buffer, 0)
      @_f1009 = FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
      @_f1010 = FinalModelStructOptional.new(self.buffer, 0)
      @_f1011 = FBE::FinalModelOptional.new(FinalModelStructOptional.new(self.buffer, 0), self.buffer, 0)
    end

    def parent
      @_parent
    end

    def f1000
      @_f1000
    end

    def f1001
      @_f1001
    end

    def f1002
      @_f1002
    end

    def f1003
      @_f1003
    end

    def f1004
      @_f1004
    end

    def f1005
      @_f1005
    end

    def f1006
      @_f1006
    end

    def f1007
      @_f1007
    end

    def f1008
      @_f1008
    end

    def f1009
      @_f1009
    end

    def f1010
      @_f1010
    end

    def f1011
      @_f1011
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + parent.fbe_allocation_size(fbe_value) \
        + f1000.fbe_allocation_size(fbe_value.f1000) \
        + f1001.fbe_allocation_size(fbe_value.f1001) \
        + f1002.fbe_allocation_size(fbe_value.f1002) \
        + f1003.fbe_allocation_size(fbe_value.f1003) \
        + f1004.fbe_allocation_size(fbe_value.f1004) \
        + f1005.fbe_allocation_size(fbe_value.f1005) \
        + f1006.fbe_allocation_size(fbe_value.f1006) \
        + f1007.fbe_allocation_size(fbe_value.f1007) \
        + f1008.fbe_allocation_size(fbe_value.f1008) \
        + f1009.fbe_allocation_size(fbe_value.f1009) \
        + f1010.fbe_allocation_size(fbe_value.f1010) \
        + f1011.fbe_allocation_size(fbe_value.f1011) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 112

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      parent.fbe_offset = fbe_current_offset
      fbe_field_size = parent.verify_fields
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1000.fbe_offset = fbe_current_offset
      fbe_field_size = f1000.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1001.fbe_offset = fbe_current_offset
      fbe_field_size = f1001.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1002.fbe_offset = fbe_current_offset
      fbe_field_size = f1002.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1003.fbe_offset = fbe_current_offset
      fbe_field_size = f1003.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1004.fbe_offset = fbe_current_offset
      fbe_field_size = f1004.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1005.fbe_offset = fbe_current_offset
      fbe_field_size = f1005.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1006.fbe_offset = fbe_current_offset
      fbe_field_size = f1006.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1007.fbe_offset = fbe_current_offset
      fbe_field_size = f1007.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1008.fbe_offset = fbe_current_offset
      fbe_field_size = f1008.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1009.fbe_offset = fbe_current_offset
      fbe_field_size = f1009.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1010.fbe_offset = fbe_current_offset
      fbe_field_size = f1010.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f1011.fbe_offset = fbe_current_offset
      fbe_field_size = f1011.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructNested.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      parent.fbe_offset = fbe_current_offset
      fbe_result = parent.get_fields(fbe_value)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result
      fbe_current_size += fbe_result

      f1000.fbe_offset = fbe_current_offset
      fbe_result = f1000.get
      fbe_value.f1000 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1001.fbe_offset = fbe_current_offset
      fbe_result = f1001.get
      fbe_value.f1001 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1002.fbe_offset = fbe_current_offset
      fbe_result = f1002.get
      fbe_value.f1002 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1003.fbe_offset = fbe_current_offset
      fbe_result = f1003.get
      fbe_value.f1003 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1004.fbe_offset = fbe_current_offset
      fbe_result = f1004.get
      fbe_value.f1004 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1005.fbe_offset = fbe_current_offset
      fbe_result = f1005.get
      fbe_value.f1005 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1006.fbe_offset = fbe_current_offset
      fbe_result = f1006.get
      fbe_value.f1006 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1007.fbe_offset = fbe_current_offset
      fbe_result = f1007.get
      fbe_value.f1007 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1008.fbe_offset = fbe_current_offset
      fbe_result = f1008.get
      fbe_value.f1008 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1009.fbe_offset = fbe_current_offset
      fbe_result = f1009.get
      fbe_value.f1009 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1010.fbe_offset = fbe_current_offset
      fbe_result = f1010.get
      fbe_value.f1010 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f1011.fbe_offset = fbe_current_offset
      fbe_result = f1011.get
      fbe_value.f1011 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      parent.fbe_offset = fbe_current_offset
      fbe_field_size = parent.set_fields(fbe_value)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1000.fbe_offset = fbe_current_offset
      fbe_field_size = f1000.set(fbe_value.f1000)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1001.fbe_offset = fbe_current_offset
      fbe_field_size = f1001.set(fbe_value.f1001)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1002.fbe_offset = fbe_current_offset
      fbe_field_size = f1002.set(fbe_value.f1002)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1003.fbe_offset = fbe_current_offset
      fbe_field_size = f1003.set(fbe_value.f1003)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1004.fbe_offset = fbe_current_offset
      fbe_field_size = f1004.set(fbe_value.f1004)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1005.fbe_offset = fbe_current_offset
      fbe_field_size = f1005.set(fbe_value.f1005)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1006.fbe_offset = fbe_current_offset
      fbe_field_size = f1006.set(fbe_value.f1006)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1007.fbe_offset = fbe_current_offset
      fbe_field_size = f1007.set(fbe_value.f1007)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1008.fbe_offset = fbe_current_offset
      fbe_field_size = f1008.set(fbe_value.f1008)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1009.fbe_offset = fbe_current_offset
      fbe_field_size = f1009.set(fbe_value.f1009)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1010.fbe_offset = fbe_current_offset
      fbe_field_size = f1010.set(fbe_value.f1010)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f1011.fbe_offset = fbe_current_offset
      fbe_field_size = f1011.set(fbe_value.f1011)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructNested final model
  class StructNestedFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructNested.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructNested::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructNested.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructNested.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructNested.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructBytes
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3

    def initialize(f1 = '', f2 = nil, f3 = nil)
      @f1 = f1
      @f2 = f2
      @f3 = f3
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructBytes)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructBytes('
      result << 'f1='
      if !@f1.nil?
        result << 'bytes[' << @f1.length.to_s << ']'
      else
        result << 'null'
      end
      result << ',f2='
      if !@f2.nil?
        result << 'bytes[' << @f2.length.to_s << ']'
      else
        result << 'null'
      end
      result << ',f3='
      if !@f3.nil?
        result << 'bytes[' << @f3.length.to_s << ']'
      else
        result << 'null'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructBytesModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructBytesModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = (f1.nil? ? nil : Base64.encode64(f1).chomp!)
      result.store(key, value)
      key = 'f2'
      value = (f2.nil? ? nil : Base64.encode64(f2).chomp!)
      result.store(key, value)
      key = 'f3'
      value = (f3.nil? ? nil : Base64.encode64(f3).chomp!)
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructBytes.new
      value = json.fetch('f1', nil)
      result.f1 = (value.nil? ? nil : Base64.decode64(value))
      value = json.fetch('f2', nil)
      result.f2 = (value.nil? ? nil : Base64.decode64(value))
      value = json.fetch('f3', nil)
      result.f3 = (value.nil? ? nil : Base64.decode64(value))
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 120
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructBytes < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelBytes.new(self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 120

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructBytes.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        fbe_value.f1 = f1.get
      else
        fbe_value.f1 = ''
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        fbe_value.f2 = f2.get
      else
        fbe_value.f2 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        fbe_value.f3 = f3.get(nil)
      else
        fbe_value.f3 = nil
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
    end
  end

  # Fast Binary Encoding StructBytes model
  class StructBytesModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructBytes.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructBytes::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructBytes.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructBytes.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructBytes.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructBytes < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelBytes.new(self.buffer, 0)
      @_f2 = FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 120

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructBytes.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get
      fbe_value.f1 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get
      fbe_value.f2 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get
      fbe_value.f3 = fbe_result[0]
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructBytes final model
  class StructBytesFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructBytes.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructBytes::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructBytes.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructBytes.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructBytes.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructArray
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10

    def initialize(f1 = Array.new(2, 0), f2 = Array.new(2, nil), f3 = Array.new(2, ''), f4 = Array.new(2, nil), f5 = Array.new(2, EnumSimple.new), f6 = Array.new(2, nil), f7 = Array.new(2, FlagsSimple.new), f8 = Array.new(2, nil), f9 = Array.new(2, StructSimple.new), f10 = Array.new(2, nil))
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructArray)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructArray('
      result << 'f1='
      if @f1.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f1.length.to_s << ']['
        @f1.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f2.length.to_s << ']['
        @f2.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f3.length.to_s << ']['
        @f3.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f4.length.to_s << ']['
        @f4.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f5='
      if @f5.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f5.length.to_s << ']['
        @f5.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f6='
      if @f6.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f6.length.to_s << ']['
        @f6.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f7='
      if @f7.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f7.length.to_s << ']['
        @f7.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f8='
      if @f8.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f8.length.to_s << ']['
        @f8.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f9='
      if @f9.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f9.length.to_s << ']['
        @f9.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f10='
      if @f10.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f10.length.to_s << ']['
        @f10.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructArrayModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructArrayModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f2'
      value = f2.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f3'
      value = f3.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f4'
      value = f4.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f5'
      value = f5.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f6'
      value = f6.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f7'
      value = f7.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f8'
      value = f8.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f9'
      value = f9.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f10'
      value = f10.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructArray.new
      value = json.fetch('f1', nil)
      result.f1 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f2', nil)
      result.f2 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f3', nil)
      result.f3 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f4', nil)
      result.f4 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f5', nil)
      result.f5 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f6', nil)
      result.f6 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f7', nil)
      result.f7 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f8', nil)
      result.f8 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f9', nil)
      result.f9 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      value = json.fetch('f10', nil)
      result.f10 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 125
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructArray < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelArray.new(FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4, 2)
      @_f2 = FBE::FieldModelArray.new(FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size, 2)
      @_f3 = FBE::FieldModelArray.new(FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size, 2)
      @_f4 = FBE::FieldModelArray.new(FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size, 2)
      @_f5 = FBE::FieldModelArray.new(FieldModelEnumSimple.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), self.buffer, @_f4.fbe_offset + @_f4.fbe_size, 2)
      @_f6 = FBE::FieldModelArray.new(FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size, 2)
      @_f7 = FBE::FieldModelArray.new(FieldModelFlagsSimple.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), self.buffer, @_f6.fbe_offset + @_f6.fbe_size, 2)
      @_f8 = FBE::FieldModelArray.new(FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size, 2)
      @_f9 = FBE::FieldModelArray.new(FieldModelStructSimple.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), self.buffer, @_f8.fbe_offset + @_f8.fbe_size, 2)
      @_f10 = FBE::FieldModelArray.new(FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size, 2)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 125

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructArray.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        f5.get(fbe_value.f5)
      else
        fbe_value.f5.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        f6.get(fbe_value.f6)
      else
        fbe_value.f6.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        f7.get(fbe_value.f7)
      else
        fbe_value.f7.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        f8.get(fbe_value.f8)
      else
        fbe_value.f8.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        f9.get(fbe_value.f9)
      else
        fbe_value.f9.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        f10.get(fbe_value.f10)
      else
        fbe_value.f10.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
    end
  end

  # Fast Binary Encoding StructArray model
  class StructArrayModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructArray.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructArray::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructArray.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructArray.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructArray.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructArray < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelArray.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0, 2)
      @_f2 = FBE::FinalModelArray.new(FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0), self.buffer, 0, 2)
      @_f3 = FBE::FinalModelArray.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0, 2)
      @_f4 = FBE::FinalModelArray.new(FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0), self.buffer, 0, 2)
      @_f5 = FBE::FinalModelArray.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0, 2)
      @_f6 = FBE::FinalModelArray.new(FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0, 2)
      @_f7 = FBE::FinalModelArray.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0, 2)
      @_f8 = FBE::FinalModelArray.new(FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0, 2)
      @_f9 = FBE::FinalModelArray.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0, 2)
      @_f10 = FBE::FinalModelArray.new(FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0, 2)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 125

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructArray.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructArray final model
  class StructArrayFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructArray.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructArray::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructArray.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructArray.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructArray.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructVector
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10

    def initialize(f1 = Array.new, f2 = Array.new, f3 = Array.new, f4 = Array.new, f5 = Array.new, f6 = Array.new, f7 = Array.new, f8 = Array.new, f9 = Array.new, f10 = Array.new)
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructVector)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructVector('
      result << 'f1='
      if @f1.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f1.length.to_s << ']['
        @f1.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f2.length.to_s << ']['
        @f2.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f3.length.to_s << ']['
        @f3.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f4.length.to_s << ']['
        @f4.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f5='
      if @f5.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f5.length.to_s << ']['
        @f5.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f6='
      if @f6.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f6.length.to_s << ']['
        @f6.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f7='
      if @f7.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f7.length.to_s << ']['
        @f7.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f8='
      if @f8.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f8.length.to_s << ']['
        @f8.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f9='
      if @f9.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f9.length.to_s << ']['
        @f9.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ',f10='
      if @f10.nil?
        result << '[0][]'
      else
        first = true
        result << '[' << @f10.length.to_s << ']['
        @f10.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << ']'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructVectorModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructVectorModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f2'
      value = f2.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f3'
      value = f3.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f4'
      value = f4.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f5'
      value = f5.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f6'
      value = f6.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f7'
      value = f7.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f8'
      value = f8.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f9'
      value = f9.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f10'
      value = f10.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructVector.new
      value = json.fetch('f1', nil)
      result.f1 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f2', nil)
      result.f2 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f3', nil)
      result.f3 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f4', nil)
      result.f4 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f5', nil)
      result.f5 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f6', nil)
      result.f6 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f7', nil)
      result.f7 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f8', nil)
      result.f8 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f9', nil)
      result.f9 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      value = json.fetch('f10', nil)
      result.f10 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 130
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructVector < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelVector.new(FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelVector.new(FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
      @_f5 = FBE::FieldModelVector.new(FieldModelEnumSimple.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), self.buffer, @_f4.fbe_offset + @_f4.fbe_size)
      @_f6 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size)
      @_f7 = FBE::FieldModelVector.new(FieldModelFlagsSimple.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), self.buffer, @_f6.fbe_offset + @_f6.fbe_size)
      @_f8 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size)
      @_f9 = FBE::FieldModelVector.new(FieldModelStructSimple.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), self.buffer, @_f8.fbe_offset + @_f8.fbe_size)
      @_f10 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 130

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructVector.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        f5.get(fbe_value.f5)
      else
        fbe_value.f5.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        f6.get(fbe_value.f6)
      else
        fbe_value.f6.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        f7.get(fbe_value.f7)
      else
        fbe_value.f7.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        f8.get(fbe_value.f8)
      else
        fbe_value.f8.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        f9.get(fbe_value.f9)
      else
        fbe_value.f9.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        f10.get(fbe_value.f10)
      else
        fbe_value.f10.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
    end
  end

  # Fast Binary Encoding StructVector model
  class StructVectorModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructVector.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructVector::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructVector.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructVector.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructVector.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructVector < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelVector.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelVector.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
      @_f4 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f5 = FBE::FinalModelVector.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f6 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f7 = FBE::FinalModelVector.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f8 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f9 = FBE::FinalModelVector.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
      @_f10 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 130

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructVector.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructVector final model
  class StructVectorFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructVector.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructVector::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructVector.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructVector.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructVector.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructList
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10

    def initialize(f1 = Array.new, f2 = Array.new, f3 = Array.new, f4 = Array.new, f5 = Array.new, f6 = Array.new, f7 = Array.new, f8 = Array.new, f9 = Array.new, f10 = Array.new)
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructList)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructList('
      result << 'f1='
      if @f1.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f1.length.to_s << ']<'
        @f1.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f2.length.to_s << ']<'
        @f2.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f3.length.to_s << ']<'
        @f3.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f4.length.to_s << ']<'
        @f4.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << 'bytes[' << item.length.to_s << ']'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f5='
      if @f5.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f5.length.to_s << ']<'
        @f5.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f6='
      if @f6.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f6.length.to_s << ']<'
        @f6.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f7='
      if @f7.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f7.length.to_s << ']<'
        @f7.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f8='
      if @f8.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f8.length.to_s << ']<'
        @f8.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f9='
      if @f9.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f9.length.to_s << ']<'
        @f9.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ',f10='
      if @f10.nil?
        result << '[0]<>'
      else
        first = true
        result << '[' << @f10.length.to_s << ']<'
        @f10.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '>'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructListModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructListModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f2'
      value = f2.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f3'
      value = f3.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f4'
      value = f4.map { |item| (item.nil? ? nil : Base64.encode64(item).chomp!) }
      result.store(key, value)
      key = 'f5'
      value = f5.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f6'
      value = f6.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f7'
      value = f7.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f8'
      value = f8.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f9'
      value = f9.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f10'
      value = f10.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructList.new
      value = json.fetch('f1', nil)
      result.f1 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f2', nil)
      result.f2 = value.map { |item| (item.nil? ? nil : item) }
      value = json.fetch('f3', nil)
      result.f3 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f4', nil)
      result.f4 = value.map { |item| (item.nil? ? nil : Base64.decode64(item)) }
      value = json.fetch('f5', nil)
      result.f5 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f6', nil)
      result.f6 = value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }
      value = json.fetch('f7', nil)
      result.f7 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f8', nil)
      result.f8 = value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }
      value = json.fetch('f9', nil)
      result.f9 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      value = json.fetch('f10', nil)
      result.f10 = value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 131
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructList < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelVector.new(FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelVector.new(FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
      @_f5 = FBE::FieldModelVector.new(FieldModelEnumSimple.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), self.buffer, @_f4.fbe_offset + @_f4.fbe_size)
      @_f6 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size)
      @_f7 = FBE::FieldModelVector.new(FieldModelFlagsSimple.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), self.buffer, @_f6.fbe_offset + @_f6.fbe_size)
      @_f8 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size)
      @_f9 = FBE::FieldModelVector.new(FieldModelStructSimple.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), self.buffer, @_f8.fbe_offset + @_f8.fbe_size)
      @_f10 = FBE::FieldModelVector.new(FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 131

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructList.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        f5.get(fbe_value.f5)
      else
        fbe_value.f5.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        f6.get(fbe_value.f6)
      else
        fbe_value.f6.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        f7.get(fbe_value.f7)
      else
        fbe_value.f7.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        f8.get(fbe_value.f8)
      else
        fbe_value.f8.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        f9.get(fbe_value.f9)
      else
        fbe_value.f9.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        f10.get(fbe_value.f10)
      else
        fbe_value.f10.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
    end
  end

  # Fast Binary Encoding StructList model
  class StructListModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructList.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructList::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructList.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructList.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructList.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructList < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelVector.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelVector.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
      @_f4 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f5 = FBE::FinalModelVector.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f6 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f7 = FBE::FinalModelVector.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f8 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f9 = FBE::FinalModelVector.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
      @_f10 = FBE::FinalModelVector.new(FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 131

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructList.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructList final model
  class StructListFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructList.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructList::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructList.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructList.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructList.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructSet
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4

    def initialize(f1 = Set.new, f2 = Set.new, f3 = Set.new, f4 = Set.new)
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructSet)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructSet('
      result << 'f1='
      if @f1.nil?
        result << '[0]{}'
      else
        first = true
        result << '[' << @f1.length.to_s << ']{'
        @f1.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '}'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0]{}'
      else
        first = true
        result << '[' << @f2.length.to_s << ']{'
        @f2.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '}'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0]{}'
      else
        first = true
        result << '[' << @f3.length.to_s << ']{'
        @f3.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '}'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0]{}'
      else
        first = true
        result << '[' << @f4.length.to_s << ']{'
        @f4.each do |item|
          if !item.nil?
            result << (first ? '' : ',')
            result << item.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          first = false
        end
        result << '}'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructSetModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructSetModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |item| (item.nil? ? nil : item) }
      result.store(key, value)
      key = 'f2'
      value = f2.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f3'
      value = f3.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      key = 'f4'
      value = f4.map { |item| (item.nil? ? nil : item.__to_json_map__) }
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructSet.new
      value = json.fetch('f1', nil)
      result.f1 = (value.map { |item| (item.nil? ? nil : item) }).to_set
      value = json.fetch('f2', nil)
      result.f2 = (value.map { |item| (item.nil? ? nil : EnumSimple.__from_json_map__(item)) }).to_set
      value = json.fetch('f3', nil)
      result.f3 = (value.map { |item| (item.nil? ? nil : FlagsSimple.__from_json_map__(item)) }).to_set
      value = json.fetch('f4', nil)
      result.f4 = (value.map { |item| (item.nil? ? nil : StructSimple.__from_json_map__(item)) }).to_set
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 132
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructSet < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelSet.new(FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelSet.new(FieldModelEnumSimple.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelSet.new(FieldModelFlagsSimple.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelSet.new(FieldModelStructSimple.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 132

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructSet.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
    end
  end

  # Fast Binary Encoding StructSet model
  class StructSetModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructSet.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructSet::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructSet.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructSet.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructSet.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructSet < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelSet.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelSet.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelSet.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f4 = FBE::FinalModelSet.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 132

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructSet.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructSet final model
  class StructSetFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructSet.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructSet::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructSet.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructSet.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructSet.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructMap
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10

    def initialize(f1 = Hash.new, f2 = Hash.new, f3 = Hash.new, f4 = Hash.new, f5 = Hash.new, f6 = Hash.new, f7 = Hash.new, f8 = Hash.new, f9 = Hash.new, f10 = Hash.new)
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructMap)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructMap('
      result << 'f1='
      if @f1.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f1.length.to_s << ']<{'
        @f1.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f2.length.to_s << ']<{'
        @f2.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f3.length.to_s << ']<{'
        @f3.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << 'bytes[' << value.length.to_s << ']'
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f4.length.to_s << ']<{'
        @f4.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << 'bytes[' << value.length.to_s << ']'
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f5='
      if @f5.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f5.length.to_s << ']<{'
        @f5.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f6='
      if @f6.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f6.length.to_s << ']<{'
        @f6.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f7='
      if @f7.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f7.length.to_s << ']<{'
        @f7.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f8='
      if @f8.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f8.length.to_s << ']<{'
        @f8.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f9='
      if @f9.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f9.length.to_s << ']<{'
        @f9.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ',f10='
      if @f10.nil?
        result << '[0]<{}>'
      else
        first = true
        result << '[' << @f10.length.to_s << ']<{'
        @f10.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}>'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructMapModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructMapModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |key, value| [key.to_s, (value.nil? ? nil : value)] }.to_h
      result.store(key, value)
      key = 'f2'
      value = f2.map { |key, value| [key.to_s, (value.nil? ? nil : value)] }.to_h
      result.store(key, value)
      key = 'f3'
      value = f3.map { |key, value| [key.to_s, (value.nil? ? nil : Base64.encode64(value).chomp!)] }.to_h
      result.store(key, value)
      key = 'f4'
      value = f4.map { |key, value| [key.to_s, (value.nil? ? nil : Base64.encode64(value).chomp!)] }.to_h
      result.store(key, value)
      key = 'f5'
      value = f5.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f6'
      value = f6.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f7'
      value = f7.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f8'
      value = f8.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f9'
      value = f9.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f10'
      value = f10.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructMap.new
      value = json.fetch('f1', nil)
      result.f1 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : value)] }).to_h
      value = json.fetch('f2', nil)
      result.f2 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : value)] }).to_h
      value = json.fetch('f3', nil)
      result.f3 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : Base64.decode64(value))] }).to_h
      value = json.fetch('f4', nil)
      result.f4 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : Base64.decode64(value))] }).to_h
      value = json.fetch('f5', nil)
      result.f5 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : EnumSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f6', nil)
      result.f6 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : EnumSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f7', nil)
      result.f7 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : FlagsSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f8', nil)
      result.f8 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : FlagsSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f9', nil)
      result.f9 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : StructSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f10', nil)
      result.f10 = (value.map { |key, value| [key.to_i, (value.nil? ? nil : StructSimple.__from_json_map__(value))] }).to_h
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 140
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructMap < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, 4 + 4), FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
      @_f5 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), FieldModelEnumSimple.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), self.buffer, @_f4.fbe_offset + @_f4.fbe_size)
      @_f6 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size)
      @_f7 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), FieldModelFlagsSimple.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), self.buffer, @_f6.fbe_offset + @_f6.fbe_size)
      @_f8 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size)
      @_f9 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), FieldModelStructSimple.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), self.buffer, @_f8.fbe_offset + @_f8.fbe_size)
      @_f10 = FBE::FieldModelMap.new(FBE::FieldModelInt32.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 140

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructMap.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        f5.get(fbe_value.f5)
      else
        fbe_value.f5.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        f6.get(fbe_value.f6)
      else
        fbe_value.f6.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        f7.get(fbe_value.f7)
      else
        fbe_value.f7.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        f8.get(fbe_value.f8)
      else
        fbe_value.f8.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        f9.get(fbe_value.f9)
      else
        fbe_value.f9.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        f10.get(fbe_value.f10)
      else
        fbe_value.f10.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
    end
  end

  # Fast Binary Encoding StructMap model
  class StructMapModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructMap.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructMap::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructMap.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructMap.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructMap.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructMap < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
      @_f4 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f5 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f6 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f7 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f8 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f9 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
      @_f10 = FBE::FinalModelMap.new(FBE::FinalModelInt32.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 140

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructMap.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructMap final model
  class StructMapFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructMap.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructMap::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructMap.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructMap.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructMap.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructHash
    include Comparable

    attr_accessor :f1
    attr_accessor :f2
    attr_accessor :f3
    attr_accessor :f4
    attr_accessor :f5
    attr_accessor :f6
    attr_accessor :f7
    attr_accessor :f8
    attr_accessor :f9
    attr_accessor :f10

    def initialize(f1 = Hash.new, f2 = Hash.new, f3 = Hash.new, f4 = Hash.new, f5 = Hash.new, f6 = Hash.new, f7 = Hash.new, f8 = Hash.new, f9 = Hash.new, f10 = Hash.new)
      @f1 = f1
      @f2 = f2
      @f3 = f3
      @f4 = f4
      @f5 = f5
      @f6 = f6
      @f7 = f7
      @f8 = f8
      @f9 = f9
      @f10 = f10
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
      @f3 = other.f3
      @f4 = other.f4
      @f5 = other.f5
      @f6 = other.f6
      @f7 = other.f7
      @f8 = other.f8
      @f9 = other.f9
      @f10 = other.f10
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructHash)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructHash('
      result << 'f1='
      if @f1.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f1.length.to_s << '][{'
        @f1.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f2.length.to_s << '][{'
        @f2.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f3='
      if @f3.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f3.length.to_s << '][{'
        @f3.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << 'bytes[' << value.length.to_s << ']'
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f4='
      if @f4.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f4.length.to_s << '][{'
        @f4.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << 'bytes[' << value.length.to_s << ']'
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f5='
      if @f5.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f5.length.to_s << '][{'
        @f5.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f6='
      if @f6.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f6.length.to_s << '][{'
        @f6.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f7='
      if @f7.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f7.length.to_s << '][{'
        @f7.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f8='
      if @f8.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f8.length.to_s << '][{'
        @f8.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f9='
      if @f9.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f9.length.to_s << '][{'
        @f9.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f10='
      if @f10.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f10.length.to_s << '][{'
        @f10.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << '"' << key.to_s << '"'
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructHashModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructHashModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |key, value| [key.to_s, (value.nil? ? nil : value)] }.to_h
      result.store(key, value)
      key = 'f2'
      value = f2.map { |key, value| [key.to_s, (value.nil? ? nil : value)] }.to_h
      result.store(key, value)
      key = 'f3'
      value = f3.map { |key, value| [key.to_s, (value.nil? ? nil : Base64.encode64(value).chomp!)] }.to_h
      result.store(key, value)
      key = 'f4'
      value = f4.map { |key, value| [key.to_s, (value.nil? ? nil : Base64.encode64(value).chomp!)] }.to_h
      result.store(key, value)
      key = 'f5'
      value = f5.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f6'
      value = f6.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f7'
      value = f7.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f8'
      value = f8.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f9'
      value = f9.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f10'
      value = f10.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructHash.new
      value = json.fetch('f1', nil)
      result.f1 = (value.map { |key, value| [key, (value.nil? ? nil : value)] }).to_h
      value = json.fetch('f2', nil)
      result.f2 = (value.map { |key, value| [key, (value.nil? ? nil : value)] }).to_h
      value = json.fetch('f3', nil)
      result.f3 = (value.map { |key, value| [key, (value.nil? ? nil : Base64.decode64(value))] }).to_h
      value = json.fetch('f4', nil)
      result.f4 = (value.map { |key, value| [key, (value.nil? ? nil : Base64.decode64(value))] }).to_h
      value = json.fetch('f5', nil)
      result.f5 = (value.map { |key, value| [key, (value.nil? ? nil : EnumSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f6', nil)
      result.f6 = (value.map { |key, value| [key, (value.nil? ? nil : EnumSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f7', nil)
      result.f7 = (value.map { |key, value| [key, (value.nil? ? nil : FlagsSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f8', nil)
      result.f8 = (value.map { |key, value| [key, (value.nil? ? nil : FlagsSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f9', nil)
      result.f9 = (value.map { |key, value| [key, (value.nil? ? nil : StructSimple.__from_json_map__(value))] }).to_h
      value = json.fetch('f10', nil)
      result.f10 = (value.map { |key, value| [key, (value.nil? ? nil : StructSimple.__from_json_map__(value))] }).to_h
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 141
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructHash < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, 4 + 4), FBE::FieldModelByte.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), FBE::FieldModelOptional.new(FBE::FieldModelByte.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
      @_f3 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), FBE::FieldModelBytes.new(self.buffer, @_f2.fbe_offset + @_f2.fbe_size), self.buffer, @_f2.fbe_offset + @_f2.fbe_size)
      @_f4 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), FBE::FieldModelOptional.new(FBE::FieldModelBytes.new(self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size), self.buffer, @_f3.fbe_offset + @_f3.fbe_size)
      @_f5 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), FieldModelEnumSimple.new(self.buffer, @_f4.fbe_offset + @_f4.fbe_size), self.buffer, @_f4.fbe_offset + @_f4.fbe_size)
      @_f6 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), FBE::FieldModelOptional.new(FieldModelEnumSimple.new(self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size), self.buffer, @_f5.fbe_offset + @_f5.fbe_size)
      @_f7 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), FieldModelFlagsSimple.new(self.buffer, @_f6.fbe_offset + @_f6.fbe_size), self.buffer, @_f6.fbe_offset + @_f6.fbe_size)
      @_f8 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), FBE::FieldModelOptional.new(FieldModelFlagsSimple.new(self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size), self.buffer, @_f7.fbe_offset + @_f7.fbe_size)
      @_f9 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), FieldModelStructSimple.new(self.buffer, @_f8.fbe_offset + @_f8.fbe_size), self.buffer, @_f8.fbe_offset + @_f8.fbe_size)
      @_f10 = FBE::FieldModelMap.new(FBE::FieldModelString.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), FBE::FieldModelOptional.new(FieldModelStructSimple.new(self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size), self.buffer, @_f9.fbe_offset + @_f9.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
        + f3.fbe_size \
        + f4.fbe_size \
        + f5.fbe_size \
        + f6.fbe_size \
        + f7.fbe_size \
        + f8.fbe_size \
        + f9.fbe_size \
        + f10.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \
        + f3.fbe_extra \
        + f4.fbe_extra \
        + f5.fbe_extra \
        + f6.fbe_extra \
        + f7.fbe_extra \
        + f8.fbe_extra \
        + f9.fbe_extra \
        + f10.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 141

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) > fbe_struct_size
        return true
      end
      unless f3.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) > fbe_struct_size
        return true
      end
      unless f4.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) > fbe_struct_size
        return true
      end
      unless f5.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) > fbe_struct_size
        return true
      end
      unless f6.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) > fbe_struct_size
        return true
      end
      unless f7.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) > fbe_struct_size
        return true
      end
      unless f8.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) > fbe_struct_size
        return true
      end
      unless f9.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) > fbe_struct_size
        return true
      end
      unless f10.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructHash.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      if (fbe_current_size + f3.fbe_size) <= fbe_struct_size
        f3.get(fbe_value.f3)
      else
        fbe_value.f3.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f3.fbe_size

      if (fbe_current_size + f4.fbe_size) <= fbe_struct_size
        f4.get(fbe_value.f4)
      else
        fbe_value.f4.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f4.fbe_size

      if (fbe_current_size + f5.fbe_size) <= fbe_struct_size
        f5.get(fbe_value.f5)
      else
        fbe_value.f5.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f5.fbe_size

      if (fbe_current_size + f6.fbe_size) <= fbe_struct_size
        f6.get(fbe_value.f6)
      else
        fbe_value.f6.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f6.fbe_size

      if (fbe_current_size + f7.fbe_size) <= fbe_struct_size
        f7.get(fbe_value.f7)
      else
        fbe_value.f7.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f7.fbe_size

      if (fbe_current_size + f8.fbe_size) <= fbe_struct_size
        f8.get(fbe_value.f8)
      else
        fbe_value.f8.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f8.fbe_size

      if (fbe_current_size + f9.fbe_size) <= fbe_struct_size
        f9.get(fbe_value.f9)
      else
        fbe_value.f9.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f9.fbe_size

      if (fbe_current_size + f10.fbe_size) <= fbe_struct_size
        f10.get(fbe_value.f10)
      else
        fbe_value.f10.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f10.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
      f3.set(fbe_value.f3)
      f4.set(fbe_value.f4)
      f5.set(fbe_value.f5)
      f6.set(fbe_value.f6)
      f7.set(fbe_value.f7)
      f8.set(fbe_value.f8)
      f9.set(fbe_value.f9)
      f10.set(fbe_value.f10)
    end
  end

  # Fast Binary Encoding StructHash model
  class StructHashModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructHash.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructHash::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructHash.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructHash.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructHash.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructHash < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelOptional.new(FBE::FinalModelByte.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f3 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0)
      @_f4 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelOptional.new(FBE::FinalModelBytes.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f5 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0)
      @_f6 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelEnumSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f7 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0)
      @_f8 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelFlagsSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
      @_f9 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0)
      @_f10 = FBE::FinalModelMap.new(FBE::FinalModelString.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelStructSimple.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    def f3
      @_f3
    end

    def f4
      @_f4
    end

    def f5
      @_f5
    end

    def f6
      @_f6
    end

    def f7
      @_f7
    end

    def f8
      @_f8
    end

    def f9
      @_f9
    end

    def f10
      @_f10
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
        + f3.fbe_allocation_size(fbe_value.f3) \
        + f4.fbe_allocation_size(fbe_value.f4) \
        + f5.fbe_allocation_size(fbe_value.f5) \
        + f6.fbe_allocation_size(fbe_value.f6) \
        + f7.fbe_allocation_size(fbe_value.f7) \
        + f8.fbe_allocation_size(fbe_value.f8) \
        + f9.fbe_allocation_size(fbe_value.f9) \
        + f10.fbe_allocation_size(fbe_value.f10) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 141

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructHash.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f3.fbe_offset = fbe_current_offset
      fbe_result = f3.get(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f4.fbe_offset = fbe_current_offset
      fbe_result = f4.get(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f5.fbe_offset = fbe_current_offset
      fbe_result = f5.get(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f6.fbe_offset = fbe_current_offset
      fbe_result = f6.get(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f7.fbe_offset = fbe_current_offset
      fbe_result = f7.get(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f8.fbe_offset = fbe_current_offset
      fbe_result = f8.get(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f9.fbe_offset = fbe_current_offset
      fbe_result = f9.get(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f10.fbe_offset = fbe_current_offset
      fbe_result = f10.get(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f3.fbe_offset = fbe_current_offset
      fbe_field_size = f3.set(fbe_value.f3)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f4.fbe_offset = fbe_current_offset
      fbe_field_size = f4.set(fbe_value.f4)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f5.fbe_offset = fbe_current_offset
      fbe_field_size = f5.set(fbe_value.f5)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f6.fbe_offset = fbe_current_offset
      fbe_field_size = f6.set(fbe_value.f6)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f7.fbe_offset = fbe_current_offset
      fbe_field_size = f7.set(fbe_value.f7)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f8.fbe_offset = fbe_current_offset
      fbe_field_size = f8.set(fbe_value.f8)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f9.fbe_offset = fbe_current_offset
      fbe_field_size = f9.set(fbe_value.f9)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f10.fbe_offset = fbe_current_offset
      fbe_field_size = f10.set(fbe_value.f10)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructHash final model
  class StructHashFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructHash.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructHash::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructHash.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructHash.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructHash.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructHashEx
    include Comparable

    attr_accessor :f1
    attr_accessor :f2

    def initialize(f1 = Hash.new, f2 = Hash.new)
      @f1 = f1
      @f2 = f2
    end

    def initialize_copy(other)
      @f1 = other.f1
      @f2 = other.f2
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructHashEx)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructHashEx('
      result << 'f1='
      if @f1.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f1.length.to_s << '][{'
        @f1.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ',f2='
      if @f2.nil?
        result << '[0][{}]'
      else
        first = true
        result << '[' << @f2.length.to_s << '][{'
        @f2.each do |key, value|
          if !key.nil?
            result << (first ? '' : ',')
            result << key.to_s
          else
            result << (first ? '' : ',')
            result << 'null'
          end
          result << '->'
          if !value.nil?
            result << value.to_s
          else
            result << 'null'
          end
          first = false
        end
        result << '}]'
      end
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructHashExModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructHashExModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      key = 'f1'
      value = f1.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      key = 'f2'
      value = f2.map { |key, value| [key.to_s, (value.nil? ? nil : value.__to_json_map__)] }.to_h
      result.store(key, value)
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructHashEx.new
      value = json.fetch('f1', nil)
      result.f1 = (value.map { |key, value| [key, (value.nil? ? nil : StructNested.__from_json_map__(value))] }).to_h
      value = json.fetch('f2', nil)
      result.f2 = (value.map { |key, value| [key, (value.nil? ? nil : StructNested.__from_json_map__(value))] }).to_h
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 142
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructHashEx < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FieldModelMap.new(FieldModelStructSimple.new(self.buffer, 4 + 4), FieldModelStructNested.new(self.buffer, 4 + 4), self.buffer, 4 + 4)
      @_f2 = FBE::FieldModelMap.new(FieldModelStructSimple.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), FBE::FieldModelOptional.new(FieldModelStructNested.new(self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size), self.buffer, @_f1.fbe_offset + @_f1.fbe_size)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
        + f1.fbe_size \
        + f2.fbe_size \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \
        + f1.fbe_extra \
        + f2.fbe_extra \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 142

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) > fbe_struct_size
        return true
      end
      unless f1.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) > fbe_struct_size
        return true
      end
      unless f2.verify
        return false
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size

      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructHashEx.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
      fbe_current_size = 4 + 4

      if (fbe_current_size + f1.fbe_size) <= fbe_struct_size
        f1.get(fbe_value.f1)
      else
        fbe_value.f1.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f1.fbe_size

      if (fbe_current_size + f2.fbe_size) <= fbe_struct_size
        f2.get(fbe_value.f2)
      else
        fbe_value.f2.clear
      end
      # noinspection RubyUnusedLocalVariable
      fbe_current_size += f2.fbe_size
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      f1.set(fbe_value.f1)
      f2.set(fbe_value.f2)
    end
  end

  # Fast Binary Encoding StructHashEx model
  class StructHashExModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructHashEx.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructHashEx::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructHashEx.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructHashEx.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructHashEx.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructHashEx < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
      @_f1 = FBE::FinalModelMap.new(FinalModelStructSimple.new(self.buffer, 0), FinalModelStructNested.new(self.buffer, 0), self.buffer, 0)
      @_f2 = FBE::FinalModelMap.new(FinalModelStructSimple.new(self.buffer, 0), FBE::FinalModelOptional.new(FinalModelStructNested.new(self.buffer, 0), self.buffer, 0), self.buffer, 0)
    end

    def f1
      @_f1
    end

    def f2
      @_f2
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
        + f1.fbe_allocation_size(fbe_value.f1) \
        + f2.fbe_allocation_size(fbe_value.f2) \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 142

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      fbe_current_offset = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.verify
      if fbe_field_size == FBE::Integer::MAX
        return FBE::Integer::MAX
      end
      fbe_current_offset += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_offset
    end

    # Get the struct value
    def get(fbe_value = StructHashEx.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_result = f1.get(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      f2.fbe_offset = fbe_current_offset
      fbe_result = f2.get(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_result[1]
      fbe_current_size += fbe_result[1]

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      fbe_current_offset = 0
      fbe_current_size = 0

      f1.fbe_offset = fbe_current_offset
      fbe_field_size = f1.set(fbe_value.f1)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      f2.fbe_offset = fbe_current_offset
      fbe_field_size = f2.set(fbe_value.f2)
      # noinspection RubyUnusedLocalVariable
      fbe_current_offset += fbe_field_size
      fbe_current_size += fbe_field_size

      # noinspection RubyUnnecessaryReturnValue
      fbe_current_size
    end
  end

  # Fast Binary Encoding StructHashEx final model
  class StructHashExFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructHashEx.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructHashEx::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructHashEx.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructHashEx.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructHashEx.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class StructEmpty
    include Comparable
    def initialize()
    end

    def initialize_copy(other)
    end

    # Struct shallow copy
    def copy(other)
      initialize_copy(other)
      self
    end

    # Struct deep clone
    def clone
      data = Marshal.dump(self)
      clone = Marshal.load(data)
      clone.freeze if frozen?
      clone
    end

    # Struct compare operators
    def <=>(other)
      return nil unless other.is_a?(StructEmpty)

      # noinspection RubyUnusedLocalVariable
      result = 0
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct equals
    def eql?(other)
      self == other
    end

    # Struct keys
    def key
      result = []
      # noinspection RubyUnnecessaryReturnValue
      result
    end

    # Struct hash code
    def hash
      key.hash
    end

    # Get struct string value
    def to_s
      result = ''
      result << 'StructEmpty('
      result << ')'
      result
    end

    # Dump the struct
    def marshal_dump
      # Serialize the struct to the FBE stream
      writer = StructEmptyModel.new(FBE::WriteBuffer.new)
      writer.serialize(self)
      writer.buffer
    end

    # Load the struct
    def marshal_load(data)
      # Deserialize the struct from the FBE stream
      reader = StructEmptyModel.new(FBE::ReadBuffer.new)
      reader.attach_buffer(data)
      initialize_copy(reader.deserialize[0])
    end

    # Get struct JSON value
    def to_json
      JSON.generate(__to_json_map__)
    end

    # Get struct JSON map (internal method)
    def __to_json_map__
      result = {}
      result
    end

    # Get struct from JSON
    def self.from_json(json)
      __from_json_map__(JSON.parse(json))
    end

    # Get struct map from JSON (internal method)
    def self.__from_json_map__(json)
      result = StructEmpty.new
      result
    end

    # Get the FBE type
    def fbe_type
      TYPE
    end

    TYPE = 143
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FieldModelStructEmpty < FBE::FieldModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the field size
    def fbe_size
      4
    end

    # Get the field body size
    def fbe_body
      4 + 4 \
    end

    # Get the field extra size
    def fbe_extra
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)

      fbe_result = fbe_body \

      @_buffer.unshift(fbe_struct_offset)

      fbe_result
    end

    # Get the field type
    def fbe_type
      TYPE
    end

    TYPE = 143

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify(fbe_verify_type = true)
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return true
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return false
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return false
      end

      fbe_struct_type = read_uint32(fbe_struct_offset + 4)
      if fbe_verify_type && (fbe_struct_type != fbe_type)
        return false
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_result = verify_fields(fbe_struct_size)
      @_buffer.unshift(fbe_struct_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields(fbe_struct_size)
      true
    end

    # Get the struct value (begin phase)
    def get_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_offset = read_uint32(fbe_offset)
      if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)
        return 0
      end

      fbe_struct_size = read_uint32(fbe_struct_offset)
      if fbe_struct_size < (4 + 4)
        return 0
      end

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Get the struct value (end phase)
    def get_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Get the struct value
    def get(fbe_value = StructEmpty.new)
      fbe_begin = get_begin
      if fbe_begin == 0
        return fbe_value
      end

      fbe_struct_size = read_uint32(0)
      get_fields(fbe_value, fbe_struct_size)
      get_end(fbe_begin)
      fbe_value
    end

    # Get the struct fields values
    def get_fields(fbe_value, fbe_struct_size)
    end

    # Set the struct value (begin phase)
    def set_begin
      if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size
        return 0
      end

      fbe_struct_size = fbe_body
      fbe_struct_offset = @_buffer.allocate(fbe_struct_size) - @_buffer.offset
      if (fbe_struct_offset <= 0) || ((@_buffer.offset + fbe_struct_offset + fbe_struct_size) > @_buffer.size)
        return 0
      end

      write_uint32(fbe_offset, fbe_struct_offset)
      write_uint32(fbe_struct_offset, fbe_struct_size)
      write_uint32(fbe_struct_offset + 4, fbe_type)

      @_buffer.shift(fbe_struct_offset)
      fbe_struct_offset
    end

    # Set the struct value (end phase)
    def set_end(fbe_begin)
      @_buffer.unshift(fbe_begin)
    end

    # Set the struct value
    def set(fbe_value)
      fbe_begin = set_begin
      if fbe_begin == 0
        return
      end

      set_fields(fbe_value)
      set_end(fbe_begin)
    end

    # Set the struct fields values
    def set_fields(fbe_value)
    end
  end

  # Fast Binary Encoding StructEmpty model
  class StructEmptyModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FieldModelStructEmpty.new(self.buffer, 4)
    end

    def model
      @_model
    end

    # Get the model size
    def fbe_size
      @_model.fbe_size + @_model.fbe_extra
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FieldModelStructEmpty::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        return false
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        return false
      end

      @_model.verify
    end

    # Create a new model (begin phase)
    def create_begin
      buffer.allocate(4 + @_model.fbe_size)
    end

    # Create a new model (end phase)
    def create_end(fbe_begin)
      fbe_end = buffer.size
      fbe_full_size = fbe_end - fbe_begin
      write_uint32(@_model.fbe_offset - 4, fbe_full_size)
      fbe_full_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_begin = create_begin
      @_model.set(value)
      create_end(fbe_begin)
    end

    # Deserialize the struct value
    def deserialize(value = StructEmpty.new)
      if (buffer.offset + @_model.fbe_offset - 4) > buffer.size
        [StructEmpty.new, 0]
      end

      fbe_full_size = read_uint32(@_model.fbe_offset - 4)
      if fbe_full_size < @_model.fbe_size
        [StructEmpty.new, 0]
      end

      @_model.get(value)
      [value, fbe_full_size]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalModelStructEmpty < FBE::FinalModel
    def initialize(buffer, offset)
      super(buffer, offset)
    end

    # Get the allocation size
    def fbe_allocation_size(fbe_value)
      0 \
    end

    # Get the final type
    def fbe_type
      TYPE
    end

    TYPE = 143

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      @_buffer.shift(fbe_offset)
      fbe_result = verify_fields
      @_buffer.unshift(fbe_offset)
      fbe_result
    end

    # Check if the struct fields are valid
    def verify_fields
      0
    end

    # Get the struct value
    def get(fbe_value = StructEmpty.new)
      @_buffer.shift(fbe_offset)
      fbe_size = get_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      [fbe_value, fbe_size]
    end

    # Get the struct fields values
    def get_fields(fbe_value)
      0
    end

    # Set the struct value
    def set(fbe_value)
      @_buffer.shift(fbe_offset)
      fbe_size = set_fields(fbe_value)
      @_buffer.unshift(fbe_offset)
      fbe_size
    end

    # Set the struct fields values
    def set_fields(fbe_value)
      0
    end
  end

  # Fast Binary Encoding StructEmpty final model
  class StructEmptyFinalModel < FBE::Model
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer)
      @_model = FinalModelStructEmpty.new(self.buffer, 8)
    end

    # Get the model type
    def fbe_type
      TYPE
    end

    TYPE = FinalModelStructEmpty::TYPE

    # Is the struct value valid?
    def valid?
      verify
    end

    # Check if the struct value is valid
    def verify
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        return false
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)
        return false
      end

      (8 + @_model.verify) == fbe_struct_size
    end

    # Serialize the struct value
    def serialize(value)
      fbe_initial_size = buffer.size

      fbe_struct_type = fbe_type
      fbe_struct_size = 8 + @_model.fbe_allocation_size(value)
      fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset
      if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size
        return 0
      end

      fbe_struct_size = 8 + @_model.set(value)
      buffer.resize(fbe_initial_size + fbe_struct_size)

      write_uint32(@_model.fbe_offset - 8, fbe_struct_size)
      write_uint32(@_model.fbe_offset - 4, fbe_struct_type)

      fbe_struct_size
    end

    # Deserialize the struct value
    def deserialize(value = StructEmpty.new)
      if (buffer.offset + @_model.fbe_offset) > buffer.size
        [StructEmpty.new, 0]
      end

      fbe_struct_size = read_uint32(@_model.fbe_offset - 8)
      fbe_struct_type = read_uint32(@_model.fbe_offset - 4)
      if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)
        [StructEmpty.new, 8]
      end

      fbe_result = @_model.get(value)
      [fbe_result[0], (8 + fbe_result[1])]
    end

    # Move to the next struct value
    def next(prev)
      @_model.fbe_shift(prev)
    end
  end

  # Fast Binary Encoding Test protocol version
  class ProtocolVersion
    # Protocol major version
    MAJOR = 123
    # Protocol minor version
    MINOR = 456
  end

  # Fast Binary Encoding Test sender
  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class Sender < FBE::Sender
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer, false)
      @_proto_sender = Proto::Sender.new(self.buffer)
    end

    # Imported senders

    def proto_sender
      @_proto_sender
    end

    # Sender models accessors

    # Send methods

    def send(value)
      result = @_proto_sender.send(value)
      if result > 0
        return result
      end
      0
    end

    protected

    # Send message handler
    def on_send(buffer, offset, size)
      raise NotImplementedError, "Test.Sender.on_send() not implemented!"
    end
  end

  # Fast Binary Encoding Test receiver
  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class Receiver < FBE::Receiver
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer, false)
      @_proto_receiver = Proto::Receiver.new(self.buffer)
    end

    # Imported receivers

    def proto_receiver
      @_proto_receiver
    end

    def proto_receiver=(receiver)
      @_proto_receiver = receiver
    end

    protected

    # Receive handlers

    public

    def on_receive(type, buffer, offset, size)

      if !proto_receiver.nil? && proto_receiver.on_receive(type, buffer, offset, size)
        return true
      end

      false
    end
  end

  # Fast Binary Encoding Test proxy
  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class Proxy < FBE::Receiver
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer, false)
      @_proto_proxy = Proto::Proxy.new(self.buffer)
    end

    # Imported proxy

    def proto_proxy
      @_proto_proxy
    end

    def proto_proxy=(proxy)
      @_proto_proxy = proxy
    end

    protected

    # Receive handlers

    public

    def on_receive(type, buffer, offset, size)

      if !proto_proxy.nil? && proto_proxy.on_receive(type, buffer, offset, size)
        return true
      end

      false
    end
  end

  # Fast Binary Encoding Test final sender
  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalSender < FBE::Sender
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer, true)
      @_proto_sender = Proto::FinalSender.new(self.buffer)
    end

    # Imported senders

    def proto_sender
      @_proto_sender
    end

    # Sender models accessors

    # Send methods

    def send(value)
      result = @_proto_sender.send(value)
      if result > 0
        return result
      end
      0
    end

    protected

    # Send message handler
    def on_send(buffer, offset, size)
      raise NotImplementedError, "Test.Sender.on_send() not implemented!"
    end
  end

  # Fast Binary Encoding Test final receiver
  # noinspection RubyResolve, RubyScope, RubyTooManyInstanceVariablesInspection, RubyTooManyMethodsInspection
  class FinalReceiver < FBE::Receiver
    def initialize(buffer = FBE::WriteBuffer.new)
      super(buffer, true)
      @_proto_receiver = Proto::FinalReceiver.new(self.buffer)
    end

    # Imported receivers

    def proto_receiver
      @_proto_receiver
    end

    def proto_receiver=(receiver)
      @_proto_receiver = receiver
    end

    protected

    # Receive handlers

    public

    def on_receive(type, buffer, offset, size)

      if !proto_receiver.nil? && proto_receiver.on_receive(type, buffer, offset, size)
        return true
      end

      false
    end
  end

end

# rubocop:enable all
