// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: google/protobuf/unittest_proto3.proto
//
// For information on using the generated types, please see the documenation:
//   https://github.com/apple/swift-protobuf/

// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import Foundation
import SwiftProtobuf

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}

enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case foreignZero // = 0
  case foreignFoo // = 4
  case foreignBar // = 5
  case foreignBaz // = 6
  case UNRECOGNIZED(Int)

  init() {
    self = .foreignZero
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .foreignZero
    case 4: self = .foreignFoo
    case 5: self = .foreignBar
    case 6: self = .foreignBaz
    default: self = .UNRECOGNIZED(rawValue)
    }
  }

  var rawValue: Int {
    switch self {
    case .foreignZero: return 0
    case .foreignFoo: return 4
    case .foreignBar: return 5
    case .foreignBaz: return 6
    case .UNRECOGNIZED(let i): return i
    }
  }

}

/// This proto includes every type of field in both singular and repeated
/// forms.
struct Proto3Unittest_TestAllTypes {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  /// Singular
  var optionalInt32: Int32 {
    get {return _storage._optionalInt32}
    set {_uniqueStorage()._optionalInt32 = newValue}
  }

  var optionalInt64: Int64 {
    get {return _storage._optionalInt64}
    set {_uniqueStorage()._optionalInt64 = newValue}
  }

  var optionalUint32: UInt32 {
    get {return _storage._optionalUint32}
    set {_uniqueStorage()._optionalUint32 = newValue}
  }

  var optionalUint64: UInt64 {
    get {return _storage._optionalUint64}
    set {_uniqueStorage()._optionalUint64 = newValue}
  }

  var optionalSint32: Int32 {
    get {return _storage._optionalSint32}
    set {_uniqueStorage()._optionalSint32 = newValue}
  }

  var optionalSint64: Int64 {
    get {return _storage._optionalSint64}
    set {_uniqueStorage()._optionalSint64 = newValue}
  }

  var optionalFixed32: UInt32 {
    get {return _storage._optionalFixed32}
    set {_uniqueStorage()._optionalFixed32 = newValue}
  }

  var optionalFixed64: UInt64 {
    get {return _storage._optionalFixed64}
    set {_uniqueStorage()._optionalFixed64 = newValue}
  }

  var optionalSfixed32: Int32 {
    get {return _storage._optionalSfixed32}
    set {_uniqueStorage()._optionalSfixed32 = newValue}
  }

  var optionalSfixed64: Int64 {
    get {return _storage._optionalSfixed64}
    set {_uniqueStorage()._optionalSfixed64 = newValue}
  }

  var optionalFloat: Float {
    get {return _storage._optionalFloat}
    set {_uniqueStorage()._optionalFloat = newValue}
  }

  var optionalDouble: Double {
    get {return _storage._optionalDouble}
    set {_uniqueStorage()._optionalDouble = newValue}
  }

  var optionalBool: Bool {
    get {return _storage._optionalBool}
    set {_uniqueStorage()._optionalBool = newValue}
  }

  var optionalString: String {
    get {return _storage._optionalString}
    set {_uniqueStorage()._optionalString = newValue}
  }

  var optionalBytes: Data {
    get {return _storage._optionalBytes}
    set {_uniqueStorage()._optionalBytes = newValue}
  }

  var optionalNestedMessage: Proto3Unittest_TestAllTypes.NestedMessage {
    get {return _storage._optionalNestedMessage ?? Proto3Unittest_TestAllTypes.NestedMessage()}
    set {_uniqueStorage()._optionalNestedMessage = newValue}
  }
  /// Returns true if `optionalNestedMessage` has been explicitly set.
  var hasOptionalNestedMessage: Bool {return _storage._optionalNestedMessage != nil}
  /// Clears the value of `optionalNestedMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalNestedMessage() {_storage._optionalNestedMessage = nil}

  var optionalForeignMessage: Proto3Unittest_ForeignMessage {
    get {return _storage._optionalForeignMessage ?? Proto3Unittest_ForeignMessage()}
    set {_uniqueStorage()._optionalForeignMessage = newValue}
  }
  /// Returns true if `optionalForeignMessage` has been explicitly set.
  var hasOptionalForeignMessage: Bool {return _storage._optionalForeignMessage != nil}
  /// Clears the value of `optionalForeignMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalForeignMessage() {_storage._optionalForeignMessage = nil}

  var optionalImportMessage: ProtobufUnittestImport_ImportMessage {
    get {return _storage._optionalImportMessage ?? ProtobufUnittestImport_ImportMessage()}
    set {_uniqueStorage()._optionalImportMessage = newValue}
  }
  /// Returns true if `optionalImportMessage` has been explicitly set.
  var hasOptionalImportMessage: Bool {return _storage._optionalImportMessage != nil}
  /// Clears the value of `optionalImportMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalImportMessage() {_storage._optionalImportMessage = nil}

  var optionalNestedEnum: Proto3Unittest_TestAllTypes.NestedEnum {
    get {return _storage._optionalNestedEnum}
    set {_uniqueStorage()._optionalNestedEnum = newValue}
  }

  var optionalForeignEnum: Proto3Unittest_ForeignEnum {
    get {return _storage._optionalForeignEnum}
    set {_uniqueStorage()._optionalForeignEnum = newValue}
  }

  var optionalStringPiece: String {
    get {return _storage._optionalStringPiece}
    set {_uniqueStorage()._optionalStringPiece = newValue}
  }

  var optionalCord: String {
    get {return _storage._optionalCord}
    set {_uniqueStorage()._optionalCord = newValue}
  }

  /// Defined in unittest_import_public.proto
  var optionalPublicImportMessage: ProtobufUnittestImport_PublicImportMessage {
    get {return _storage._optionalPublicImportMessage ?? ProtobufUnittestImport_PublicImportMessage()}
    set {_uniqueStorage()._optionalPublicImportMessage = newValue}
  }
  /// Returns true if `optionalPublicImportMessage` has been explicitly set.
  var hasOptionalPublicImportMessage: Bool {return _storage._optionalPublicImportMessage != nil}
  /// Clears the value of `optionalPublicImportMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalPublicImportMessage() {_storage._optionalPublicImportMessage = nil}

  var optionalLazyMessage: Proto3Unittest_TestAllTypes.NestedMessage {
    get {return _storage._optionalLazyMessage ?? Proto3Unittest_TestAllTypes.NestedMessage()}
    set {_uniqueStorage()._optionalLazyMessage = newValue}
  }
  /// Returns true if `optionalLazyMessage` has been explicitly set.
  var hasOptionalLazyMessage: Bool {return _storage._optionalLazyMessage != nil}
  /// Clears the value of `optionalLazyMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalLazyMessage() {_storage._optionalLazyMessage = nil}

  var optionalLazyImportMessage: ProtobufUnittestImport_ImportMessage {
    get {return _storage._optionalLazyImportMessage ?? ProtobufUnittestImport_ImportMessage()}
    set {_uniqueStorage()._optionalLazyImportMessage = newValue}
  }
  /// Returns true if `optionalLazyImportMessage` has been explicitly set.
  var hasOptionalLazyImportMessage: Bool {return _storage._optionalLazyImportMessage != nil}
  /// Clears the value of `optionalLazyImportMessage`. Subsequent reads from it will return its default value.
  mutating func clearOptionalLazyImportMessage() {_storage._optionalLazyImportMessage = nil}

  /// Repeated
  var repeatedInt32: [Int32] {
    get {return _storage._repeatedInt32}
    set {_uniqueStorage()._repeatedInt32 = newValue}
  }

  var repeatedInt64: [Int64] {
    get {return _storage._repeatedInt64}
    set {_uniqueStorage()._repeatedInt64 = newValue}
  }

  var repeatedUint32: [UInt32] {
    get {return _storage._repeatedUint32}
    set {_uniqueStorage()._repeatedUint32 = newValue}
  }

  var repeatedUint64: [UInt64] {
    get {return _storage._repeatedUint64}
    set {_uniqueStorage()._repeatedUint64 = newValue}
  }

  var repeatedSint32: [Int32] {
    get {return _storage._repeatedSint32}
    set {_uniqueStorage()._repeatedSint32 = newValue}
  }

  var repeatedSint64: [Int64] {
    get {return _storage._repeatedSint64}
    set {_uniqueStorage()._repeatedSint64 = newValue}
  }

  var repeatedFixed32: [UInt32] {
    get {return _storage._repeatedFixed32}
    set {_uniqueStorage()._repeatedFixed32 = newValue}
  }

  var repeatedFixed64: [UInt64] {
    get {return _storage._repeatedFixed64}
    set {_uniqueStorage()._repeatedFixed64 = newValue}
  }

  var repeatedSfixed32: [Int32] {
    get {return _storage._repeatedSfixed32}
    set {_uniqueStorage()._repeatedSfixed32 = newValue}
  }

  var repeatedSfixed64: [Int64] {
    get {return _storage._repeatedSfixed64}
    set {_uniqueStorage()._repeatedSfixed64 = newValue}
  }

  var repeatedFloat: [Float] {
    get {return _storage._repeatedFloat}
    set {_uniqueStorage()._repeatedFloat = newValue}
  }

  var repeatedDouble: [Double] {
    get {return _storage._repeatedDouble}
    set {_uniqueStorage()._repeatedDouble = newValue}
  }

  var repeatedBool: [Bool] {
    get {return _storage._repeatedBool}
    set {_uniqueStorage()._repeatedBool = newValue}
  }

  var repeatedString: [String] {
    get {return _storage._repeatedString}
    set {_uniqueStorage()._repeatedString = newValue}
  }

  var repeatedBytes: [Data] {
    get {return _storage._repeatedBytes}
    set {_uniqueStorage()._repeatedBytes = newValue}
  }

  var repeatedNestedMessage: [Proto3Unittest_TestAllTypes.NestedMessage] {
    get {return _storage._repeatedNestedMessage}
    set {_uniqueStorage()._repeatedNestedMessage = newValue}
  }

  var repeatedForeignMessage: [Proto3Unittest_ForeignMessage] {
    get {return _storage._repeatedForeignMessage}
    set {_uniqueStorage()._repeatedForeignMessage = newValue}
  }

  var repeatedImportMessage: [ProtobufUnittestImport_ImportMessage] {
    get {return _storage._repeatedImportMessage}
    set {_uniqueStorage()._repeatedImportMessage = newValue}
  }

  var repeatedNestedEnum: [Proto3Unittest_TestAllTypes.NestedEnum] {
    get {return _storage._repeatedNestedEnum}
    set {_uniqueStorage()._repeatedNestedEnum = newValue}
  }

  var repeatedForeignEnum: [Proto3Unittest_ForeignEnum] {
    get {return _storage._repeatedForeignEnum}
    set {_uniqueStorage()._repeatedForeignEnum = newValue}
  }

  var repeatedStringPiece: [String] {
    get {return _storage._repeatedStringPiece}
    set {_uniqueStorage()._repeatedStringPiece = newValue}
  }

  var repeatedCord: [String] {
    get {return _storage._repeatedCord}
    set {_uniqueStorage()._repeatedCord = newValue}
  }

  var repeatedLazyMessage: [Proto3Unittest_TestAllTypes.NestedMessage] {
    get {return _storage._repeatedLazyMessage}
    set {_uniqueStorage()._repeatedLazyMessage = newValue}
  }

  var oneofField: OneOf_OneofField? {
    get {return _storage._oneofField}
    set {_uniqueStorage()._oneofField = newValue}
  }

  var oneofUint32: UInt32 {
    get {
      if case .oneofUint32(let v)? = _storage._oneofField {return v}
      return 0
    }
    set {_uniqueStorage()._oneofField = .oneofUint32(newValue)}
  }

  var oneofNestedMessage: Proto3Unittest_TestAllTypes.NestedMessage {
    get {
      if case .oneofNestedMessage(let v)? = _storage._oneofField {return v}
      return Proto3Unittest_TestAllTypes.NestedMessage()
    }
    set {_uniqueStorage()._oneofField = .oneofNestedMessage(newValue)}
  }

  var oneofString: String {
    get {
      if case .oneofString(let v)? = _storage._oneofField {return v}
      return String()
    }
    set {_uniqueStorage()._oneofField = .oneofString(newValue)}
  }

  var oneofBytes: Data {
    get {
      if case .oneofBytes(let v)? = _storage._oneofField {return v}
      return SwiftProtobuf.Internal.emptyData
    }
    set {_uniqueStorage()._oneofField = .oneofBytes(newValue)}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum OneOf_OneofField: Equatable {
    case oneofUint32(UInt32)
    case oneofNestedMessage(Proto3Unittest_TestAllTypes.NestedMessage)
    case oneofString(String)
    case oneofBytes(Data)

    static func ==(lhs: Proto3Unittest_TestAllTypes.OneOf_OneofField, rhs: Proto3Unittest_TestAllTypes.OneOf_OneofField) -> Bool {
      switch (lhs, rhs) {
      case (.oneofUint32(let l), .oneofUint32(let r)): return l == r
      case (.oneofNestedMessage(let l), .oneofNestedMessage(let r)): return l == r
      case (.oneofString(let l), .oneofString(let r)): return l == r
      case (.oneofBytes(let l), .oneofBytes(let r)): return l == r
      default: return false
      }
    }
  }

  enum NestedEnum: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case zero // = 0
    case foo // = 1
    case bar // = 2
    case baz // = 3

    /// Intentionally negative.
    case neg // = -1
    case UNRECOGNIZED(Int)

    init() {
      self = .zero
    }

    init?(rawValue: Int) {
      switch rawValue {
      case -1: self = .neg
      case 0: self = .zero
      case 1: self = .foo
      case 2: self = .bar
      case 3: self = .baz
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    var rawValue: Int {
      switch self {
      case .neg: return -1
      case .zero: return 0
      case .foo: return 1
      case .bar: return 2
      case .baz: return 3
      case .UNRECOGNIZED(let i): return i
      }
    }

  }

  struct NestedMessage {
    // SwiftProtobuf.Message conformance is added in an extension below. See the
    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
    // methods supported on all messages.

    /// The field name "b" fails to compile in proto1 because it conflicts with
    /// a local variable named "b" in one of the generated methods.  Doh.
    /// This file needs to compile in proto1 to test backwards-compatibility.
    var bb: Int32 = 0

    var unknownFields = SwiftProtobuf.UnknownStorage()

    init() {}
  }

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

struct Proto3Unittest_TestPackedTypes {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var packedInt32: [Int32] = []

  var packedInt64: [Int64] = []

  var packedUint32: [UInt32] = []

  var packedUint64: [UInt64] = []

  var packedSint32: [Int32] = []

  var packedSint64: [Int64] = []

  var packedFixed32: [UInt32] = []

  var packedFixed64: [UInt64] = []

  var packedSfixed32: [Int32] = []

  var packedSfixed64: [Int64] = []

  var packedFloat: [Float] = []

  var packedDouble: [Double] = []

  var packedBool: [Bool] = []

  var packedEnum: [Proto3Unittest_ForeignEnum] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

/// Explicitly set packed to false
struct Proto3Unittest_TestUnpackedTypes {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var repeatedInt32: [Int32] = []

  var repeatedInt64: [Int64] = []

  var repeatedUint32: [UInt32] = []

  var repeatedUint64: [UInt64] = []

  var repeatedSint32: [Int32] = []

  var repeatedSint64: [Int64] = []

  var repeatedFixed32: [UInt32] = []

  var repeatedFixed64: [UInt64] = []

  var repeatedSfixed32: [Int32] = []

  var repeatedSfixed64: [Int64] = []

  var repeatedFloat: [Float] = []

  var repeatedDouble: [Double] = []

  var repeatedBool: [Bool] = []

  var repeatedNestedEnum: [Proto3Unittest_TestAllTypes.NestedEnum] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

/// This proto includes a recusively nested message.
struct Proto3Unittest_NestedTestAllTypes {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var child: Proto3Unittest_NestedTestAllTypes {
    get {return _storage._child ?? Proto3Unittest_NestedTestAllTypes()}
    set {_uniqueStorage()._child = newValue}
  }
  /// Returns true if `child` has been explicitly set.
  var hasChild: Bool {return _storage._child != nil}
  /// Clears the value of `child`. Subsequent reads from it will return its default value.
  mutating func clearChild() {_storage._child = nil}

  var payload: Proto3Unittest_TestAllTypes {
    get {return _storage._payload ?? Proto3Unittest_TestAllTypes()}
    set {_uniqueStorage()._payload = newValue}
  }
  /// Returns true if `payload` has been explicitly set.
  var hasPayload: Bool {return _storage._payload != nil}
  /// Clears the value of `payload`. Subsequent reads from it will return its default value.
  mutating func clearPayload() {_storage._payload = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

/// Define these after TestAllTypes to make sure the compiler can handle
/// that.
struct Proto3Unittest_ForeignMessage {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var c: Int32 = 0

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

/// TestEmptyMessage is used to test behavior of unknown fields.
struct Proto3Unittest_TestEmptyMessage {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

// MARK: - Code below here is support for the SwiftProtobuf runtime.

fileprivate let _protobuf_package = "proto3_unittest"

extension Proto3Unittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "FOREIGN_ZERO"),
    4: .same(proto: "FOREIGN_FOO"),
    5: .same(proto: "FOREIGN_BAR"),
    6: .same(proto: "FOREIGN_BAZ"),
  ]
}

extension Proto3Unittest_TestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".TestAllTypes"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "optional_int32"),
    2: .standard(proto: "optional_int64"),
    3: .standard(proto: "optional_uint32"),
    4: .standard(proto: "optional_uint64"),
    5: .standard(proto: "optional_sint32"),
    6: .standard(proto: "optional_sint64"),
    7: .standard(proto: "optional_fixed32"),
    8: .standard(proto: "optional_fixed64"),
    9: .standard(proto: "optional_sfixed32"),
    10: .standard(proto: "optional_sfixed64"),
    11: .standard(proto: "optional_float"),
    12: .standard(proto: "optional_double"),
    13: .standard(proto: "optional_bool"),
    14: .standard(proto: "optional_string"),
    15: .standard(proto: "optional_bytes"),
    18: .standard(proto: "optional_nested_message"),
    19: .standard(proto: "optional_foreign_message"),
    20: .standard(proto: "optional_import_message"),
    21: .standard(proto: "optional_nested_enum"),
    22: .standard(proto: "optional_foreign_enum"),
    24: .standard(proto: "optional_string_piece"),
    25: .standard(proto: "optional_cord"),
    26: .standard(proto: "optional_public_import_message"),
    27: .standard(proto: "optional_lazy_message"),
    115: .standard(proto: "optional_lazy_import_message"),
    31: .standard(proto: "repeated_int32"),
    32: .standard(proto: "repeated_int64"),
    33: .standard(proto: "repeated_uint32"),
    34: .standard(proto: "repeated_uint64"),
    35: .standard(proto: "repeated_sint32"),
    36: .standard(proto: "repeated_sint64"),
    37: .standard(proto: "repeated_fixed32"),
    38: .standard(proto: "repeated_fixed64"),
    39: .standard(proto: "repeated_sfixed32"),
    40: .standard(proto: "repeated_sfixed64"),
    41: .standard(proto: "repeated_float"),
    42: .standard(proto: "repeated_double"),
    43: .standard(proto: "repeated_bool"),
    44: .standard(proto: "repeated_string"),
    45: .standard(proto: "repeated_bytes"),
    48: .standard(proto: "repeated_nested_message"),
    49: .standard(proto: "repeated_foreign_message"),
    50: .standard(proto: "repeated_import_message"),
    51: .standard(proto: "repeated_nested_enum"),
    52: .standard(proto: "repeated_foreign_enum"),
    54: .standard(proto: "repeated_string_piece"),
    55: .standard(proto: "repeated_cord"),
    57: .standard(proto: "repeated_lazy_message"),
    111: .standard(proto: "oneof_uint32"),
    112: .standard(proto: "oneof_nested_message"),
    113: .standard(proto: "oneof_string"),
    114: .standard(proto: "oneof_bytes"),
  ]

  fileprivate class _StorageClass {
    var _optionalInt32: Int32 = 0
    var _optionalInt64: Int64 = 0
    var _optionalUint32: UInt32 = 0
    var _optionalUint64: UInt64 = 0
    var _optionalSint32: Int32 = 0
    var _optionalSint64: Int64 = 0
    var _optionalFixed32: UInt32 = 0
    var _optionalFixed64: UInt64 = 0
    var _optionalSfixed32: Int32 = 0
    var _optionalSfixed64: Int64 = 0
    var _optionalFloat: Float = 0
    var _optionalDouble: Double = 0
    var _optionalBool: Bool = false
    var _optionalString: String = String()
    var _optionalBytes: Data = SwiftProtobuf.Internal.emptyData
    var _optionalNestedMessage: Proto3Unittest_TestAllTypes.NestedMessage? = nil
    var _optionalForeignMessage: Proto3Unittest_ForeignMessage? = nil
    var _optionalImportMessage: ProtobufUnittestImport_ImportMessage? = nil
    var _optionalNestedEnum: Proto3Unittest_TestAllTypes.NestedEnum = .zero
    var _optionalForeignEnum: Proto3Unittest_ForeignEnum = .foreignZero
    var _optionalStringPiece: String = String()
    var _optionalCord: String = String()
    var _optionalPublicImportMessage: ProtobufUnittestImport_PublicImportMessage? = nil
    var _optionalLazyMessage: Proto3Unittest_TestAllTypes.NestedMessage? = nil
    var _optionalLazyImportMessage: ProtobufUnittestImport_ImportMessage? = nil
    var _repeatedInt32: [Int32] = []
    var _repeatedInt64: [Int64] = []
    var _repeatedUint32: [UInt32] = []
    var _repeatedUint64: [UInt64] = []
    var _repeatedSint32: [Int32] = []
    var _repeatedSint64: [Int64] = []
    var _repeatedFixed32: [UInt32] = []
    var _repeatedFixed64: [UInt64] = []
    var _repeatedSfixed32: [Int32] = []
    var _repeatedSfixed64: [Int64] = []
    var _repeatedFloat: [Float] = []
    var _repeatedDouble: [Double] = []
    var _repeatedBool: [Bool] = []
    var _repeatedString: [String] = []
    var _repeatedBytes: [Data] = []
    var _repeatedNestedMessage: [Proto3Unittest_TestAllTypes.NestedMessage] = []
    var _repeatedForeignMessage: [Proto3Unittest_ForeignMessage] = []
    var _repeatedImportMessage: [ProtobufUnittestImport_ImportMessage] = []
    var _repeatedNestedEnum: [Proto3Unittest_TestAllTypes.NestedEnum] = []
    var _repeatedForeignEnum: [Proto3Unittest_ForeignEnum] = []
    var _repeatedStringPiece: [String] = []
    var _repeatedCord: [String] = []
    var _repeatedLazyMessage: [Proto3Unittest_TestAllTypes.NestedMessage] = []
    var _oneofField: Proto3Unittest_TestAllTypes.OneOf_OneofField?

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _optionalInt32 = source._optionalInt32
      _optionalInt64 = source._optionalInt64
      _optionalUint32 = source._optionalUint32
      _optionalUint64 = source._optionalUint64
      _optionalSint32 = source._optionalSint32
      _optionalSint64 = source._optionalSint64
      _optionalFixed32 = source._optionalFixed32
      _optionalFixed64 = source._optionalFixed64
      _optionalSfixed32 = source._optionalSfixed32
      _optionalSfixed64 = source._optionalSfixed64
      _optionalFloat = source._optionalFloat
      _optionalDouble = source._optionalDouble
      _optionalBool = source._optionalBool
      _optionalString = source._optionalString
      _optionalBytes = source._optionalBytes
      _optionalNestedMessage = source._optionalNestedMessage
      _optionalForeignMessage = source._optionalForeignMessage
      _optionalImportMessage = source._optionalImportMessage
      _optionalNestedEnum = source._optionalNestedEnum
      _optionalForeignEnum = source._optionalForeignEnum
      _optionalStringPiece = source._optionalStringPiece
      _optionalCord = source._optionalCord
      _optionalPublicImportMessage = source._optionalPublicImportMessage
      _optionalLazyMessage = source._optionalLazyMessage
      _optionalLazyImportMessage = source._optionalLazyImportMessage
      _repeatedInt32 = source._repeatedInt32
      _repeatedInt64 = source._repeatedInt64
      _repeatedUint32 = source._repeatedUint32
      _repeatedUint64 = source._repeatedUint64
      _repeatedSint32 = source._repeatedSint32
      _repeatedSint64 = source._repeatedSint64
      _repeatedFixed32 = source._repeatedFixed32
      _repeatedFixed64 = source._repeatedFixed64
      _repeatedSfixed32 = source._repeatedSfixed32
      _repeatedSfixed64 = source._repeatedSfixed64
      _repeatedFloat = source._repeatedFloat
      _repeatedDouble = source._repeatedDouble
      _repeatedBool = source._repeatedBool
      _repeatedString = source._repeatedString
      _repeatedBytes = source._repeatedBytes
      _repeatedNestedMessage = source._repeatedNestedMessage
      _repeatedForeignMessage = source._repeatedForeignMessage
      _repeatedImportMessage = source._repeatedImportMessage
      _repeatedNestedEnum = source._repeatedNestedEnum
      _repeatedForeignEnum = source._repeatedForeignEnum
      _repeatedStringPiece = source._repeatedStringPiece
      _repeatedCord = source._repeatedCord
      _repeatedLazyMessage = source._repeatedLazyMessage
      _oneofField = source._oneofField
    }
  }

  fileprivate mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _StorageClass(copying: _storage)
    }
    return _storage
  }

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    _ = _uniqueStorage()
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      while let fieldNumber = try decoder.nextFieldNumber() {
        switch fieldNumber {
        case 1: try decoder.decodeSingularInt32Field(value: &_storage._optionalInt32)
        case 2: try decoder.decodeSingularInt64Field(value: &_storage._optionalInt64)
        case 3: try decoder.decodeSingularUInt32Field(value: &_storage._optionalUint32)
        case 4: try decoder.decodeSingularUInt64Field(value: &_storage._optionalUint64)
        case 5: try decoder.decodeSingularSInt32Field(value: &_storage._optionalSint32)
        case 6: try decoder.decodeSingularSInt64Field(value: &_storage._optionalSint64)
        case 7: try decoder.decodeSingularFixed32Field(value: &_storage._optionalFixed32)
        case 8: try decoder.decodeSingularFixed64Field(value: &_storage._optionalFixed64)
        case 9: try decoder.decodeSingularSFixed32Field(value: &_storage._optionalSfixed32)
        case 10: try decoder.decodeSingularSFixed64Field(value: &_storage._optionalSfixed64)
        case 11: try decoder.decodeSingularFloatField(value: &_storage._optionalFloat)
        case 12: try decoder.decodeSingularDoubleField(value: &_storage._optionalDouble)
        case 13: try decoder.decodeSingularBoolField(value: &_storage._optionalBool)
        case 14: try decoder.decodeSingularStringField(value: &_storage._optionalString)
        case 15: try decoder.decodeSingularBytesField(value: &_storage._optionalBytes)
        case 18: try decoder.decodeSingularMessageField(value: &_storage._optionalNestedMessage)
        case 19: try decoder.decodeSingularMessageField(value: &_storage._optionalForeignMessage)
        case 20: try decoder.decodeSingularMessageField(value: &_storage._optionalImportMessage)
        case 21: try decoder.decodeSingularEnumField(value: &_storage._optionalNestedEnum)
        case 22: try decoder.decodeSingularEnumField(value: &_storage._optionalForeignEnum)
        case 24: try decoder.decodeSingularStringField(value: &_storage._optionalStringPiece)
        case 25: try decoder.decodeSingularStringField(value: &_storage._optionalCord)
        case 26: try decoder.decodeSingularMessageField(value: &_storage._optionalPublicImportMessage)
        case 27: try decoder.decodeSingularMessageField(value: &_storage._optionalLazyMessage)
        case 31: try decoder.decodeRepeatedInt32Field(value: &_storage._repeatedInt32)
        case 32: try decoder.decodeRepeatedInt64Field(value: &_storage._repeatedInt64)
        case 33: try decoder.decodeRepeatedUInt32Field(value: &_storage._repeatedUint32)
        case 34: try decoder.decodeRepeatedUInt64Field(value: &_storage._repeatedUint64)
        case 35: try decoder.decodeRepeatedSInt32Field(value: &_storage._repeatedSint32)
        case 36: try decoder.decodeRepeatedSInt64Field(value: &_storage._repeatedSint64)
        case 37: try decoder.decodeRepeatedFixed32Field(value: &_storage._repeatedFixed32)
        case 38: try decoder.decodeRepeatedFixed64Field(value: &_storage._repeatedFixed64)
        case 39: try decoder.decodeRepeatedSFixed32Field(value: &_storage._repeatedSfixed32)
        case 40: try decoder.decodeRepeatedSFixed64Field(value: &_storage._repeatedSfixed64)
        case 41: try decoder.decodeRepeatedFloatField(value: &_storage._repeatedFloat)
        case 42: try decoder.decodeRepeatedDoubleField(value: &_storage._repeatedDouble)
        case 43: try decoder.decodeRepeatedBoolField(value: &_storage._repeatedBool)
        case 44: try decoder.decodeRepeatedStringField(value: &_storage._repeatedString)
        case 45: try decoder.decodeRepeatedBytesField(value: &_storage._repeatedBytes)
        case 48: try decoder.decodeRepeatedMessageField(value: &_storage._repeatedNestedMessage)
        case 49: try decoder.decodeRepeatedMessageField(value: &_storage._repeatedForeignMessage)
        case 50: try decoder.decodeRepeatedMessageField(value: &_storage._repeatedImportMessage)
        case 51: try decoder.decodeRepeatedEnumField(value: &_storage._repeatedNestedEnum)
        case 52: try decoder.decodeRepeatedEnumField(value: &_storage._repeatedForeignEnum)
        case 54: try decoder.decodeRepeatedStringField(value: &_storage._repeatedStringPiece)
        case 55: try decoder.decodeRepeatedStringField(value: &_storage._repeatedCord)
        case 57: try decoder.decodeRepeatedMessageField(value: &_storage._repeatedLazyMessage)
        case 111:
          if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
          var v: UInt32?
          try decoder.decodeSingularUInt32Field(value: &v)
          if let v = v {_storage._oneofField = .oneofUint32(v)}
        case 112:
          var v: Proto3Unittest_TestAllTypes.NestedMessage?
          if let current = _storage._oneofField {
            try decoder.handleConflictingOneOf()
            if case .oneofNestedMessage(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._oneofField = .oneofNestedMessage(v)}
        case 113:
          if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
          var v: String?
          try decoder.decodeSingularStringField(value: &v)
          if let v = v {_storage._oneofField = .oneofString(v)}
        case 114:
          if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
          var v: Data?
          try decoder.decodeSingularBytesField(value: &v)
          if let v = v {_storage._oneofField = .oneofBytes(v)}
        case 115: try decoder.decodeSingularMessageField(value: &_storage._optionalLazyImportMessage)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if _storage._optionalInt32 != 0 {
        try visitor.visitSingularInt32Field(value: _storage._optionalInt32, fieldNumber: 1)
      }
      if _storage._optionalInt64 != 0 {
        try visitor.visitSingularInt64Field(value: _storage._optionalInt64, fieldNumber: 2)
      }
      if _storage._optionalUint32 != 0 {
        try visitor.visitSingularUInt32Field(value: _storage._optionalUint32, fieldNumber: 3)
      }
      if _storage._optionalUint64 != 0 {
        try visitor.visitSingularUInt64Field(value: _storage._optionalUint64, fieldNumber: 4)
      }
      if _storage._optionalSint32 != 0 {
        try visitor.visitSingularSInt32Field(value: _storage._optionalSint32, fieldNumber: 5)
      }
      if _storage._optionalSint64 != 0 {
        try visitor.visitSingularSInt64Field(value: _storage._optionalSint64, fieldNumber: 6)
      }
      if _storage._optionalFixed32 != 0 {
        try visitor.visitSingularFixed32Field(value: _storage._optionalFixed32, fieldNumber: 7)
      }
      if _storage._optionalFixed64 != 0 {
        try visitor.visitSingularFixed64Field(value: _storage._optionalFixed64, fieldNumber: 8)
      }
      if _storage._optionalSfixed32 != 0 {
        try visitor.visitSingularSFixed32Field(value: _storage._optionalSfixed32, fieldNumber: 9)
      }
      if _storage._optionalSfixed64 != 0 {
        try visitor.visitSingularSFixed64Field(value: _storage._optionalSfixed64, fieldNumber: 10)
      }
      if _storage._optionalFloat != 0 {
        try visitor.visitSingularFloatField(value: _storage._optionalFloat, fieldNumber: 11)
      }
      if _storage._optionalDouble != 0 {
        try visitor.visitSingularDoubleField(value: _storage._optionalDouble, fieldNumber: 12)
      }
      if _storage._optionalBool != false {
        try visitor.visitSingularBoolField(value: _storage._optionalBool, fieldNumber: 13)
      }
      if !_storage._optionalString.isEmpty {
        try visitor.visitSingularStringField(value: _storage._optionalString, fieldNumber: 14)
      }
      if !_storage._optionalBytes.isEmpty {
        try visitor.visitSingularBytesField(value: _storage._optionalBytes, fieldNumber: 15)
      }
      if let v = _storage._optionalNestedMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
      }
      if let v = _storage._optionalForeignMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
      }
      if let v = _storage._optionalImportMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
      }
      if _storage._optionalNestedEnum != .zero {
        try visitor.visitSingularEnumField(value: _storage._optionalNestedEnum, fieldNumber: 21)
      }
      if _storage._optionalForeignEnum != .foreignZero {
        try visitor.visitSingularEnumField(value: _storage._optionalForeignEnum, fieldNumber: 22)
      }
      if !_storage._optionalStringPiece.isEmpty {
        try visitor.visitSingularStringField(value: _storage._optionalStringPiece, fieldNumber: 24)
      }
      if !_storage._optionalCord.isEmpty {
        try visitor.visitSingularStringField(value: _storage._optionalCord, fieldNumber: 25)
      }
      if let v = _storage._optionalPublicImportMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 26)
      }
      if let v = _storage._optionalLazyMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 27)
      }
      if !_storage._repeatedInt32.isEmpty {
        try visitor.visitPackedInt32Field(value: _storage._repeatedInt32, fieldNumber: 31)
      }
      if !_storage._repeatedInt64.isEmpty {
        try visitor.visitPackedInt64Field(value: _storage._repeatedInt64, fieldNumber: 32)
      }
      if !_storage._repeatedUint32.isEmpty {
        try visitor.visitPackedUInt32Field(value: _storage._repeatedUint32, fieldNumber: 33)
      }
      if !_storage._repeatedUint64.isEmpty {
        try visitor.visitPackedUInt64Field(value: _storage._repeatedUint64, fieldNumber: 34)
      }
      if !_storage._repeatedSint32.isEmpty {
        try visitor.visitPackedSInt32Field(value: _storage._repeatedSint32, fieldNumber: 35)
      }
      if !_storage._repeatedSint64.isEmpty {
        try visitor.visitPackedSInt64Field(value: _storage._repeatedSint64, fieldNumber: 36)
      }
      if !_storage._repeatedFixed32.isEmpty {
        try visitor.visitPackedFixed32Field(value: _storage._repeatedFixed32, fieldNumber: 37)
      }
      if !_storage._repeatedFixed64.isEmpty {
        try visitor.visitPackedFixed64Field(value: _storage._repeatedFixed64, fieldNumber: 38)
      }
      if !_storage._repeatedSfixed32.isEmpty {
        try visitor.visitPackedSFixed32Field(value: _storage._repeatedSfixed32, fieldNumber: 39)
      }
      if !_storage._repeatedSfixed64.isEmpty {
        try visitor.visitPackedSFixed64Field(value: _storage._repeatedSfixed64, fieldNumber: 40)
      }
      if !_storage._repeatedFloat.isEmpty {
        try visitor.visitPackedFloatField(value: _storage._repeatedFloat, fieldNumber: 41)
      }
      if !_storage._repeatedDouble.isEmpty {
        try visitor.visitPackedDoubleField(value: _storage._repeatedDouble, fieldNumber: 42)
      }
      if !_storage._repeatedBool.isEmpty {
        try visitor.visitPackedBoolField(value: _storage._repeatedBool, fieldNumber: 43)
      }
      if !_storage._repeatedString.isEmpty {
        try visitor.visitRepeatedStringField(value: _storage._repeatedString, fieldNumber: 44)
      }
      if !_storage._repeatedBytes.isEmpty {
        try visitor.visitRepeatedBytesField(value: _storage._repeatedBytes, fieldNumber: 45)
      }
      if !_storage._repeatedNestedMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._repeatedNestedMessage, fieldNumber: 48)
      }
      if !_storage._repeatedForeignMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._repeatedForeignMessage, fieldNumber: 49)
      }
      if !_storage._repeatedImportMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._repeatedImportMessage, fieldNumber: 50)
      }
      if !_storage._repeatedNestedEnum.isEmpty {
        try visitor.visitPackedEnumField(value: _storage._repeatedNestedEnum, fieldNumber: 51)
      }
      if !_storage._repeatedForeignEnum.isEmpty {
        try visitor.visitPackedEnumField(value: _storage._repeatedForeignEnum, fieldNumber: 52)
      }
      if !_storage._repeatedStringPiece.isEmpty {
        try visitor.visitRepeatedStringField(value: _storage._repeatedStringPiece, fieldNumber: 54)
      }
      if !_storage._repeatedCord.isEmpty {
        try visitor.visitRepeatedStringField(value: _storage._repeatedCord, fieldNumber: 55)
      }
      if !_storage._repeatedLazyMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._repeatedLazyMessage, fieldNumber: 57)
      }
      switch _storage._oneofField {
      case .oneofUint32(let v)?:
        try visitor.visitSingularUInt32Field(value: v, fieldNumber: 111)
      case .oneofNestedMessage(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 112)
      case .oneofString(let v)?:
        try visitor.visitSingularStringField(value: v, fieldNumber: 113)
      case .oneofBytes(let v)?:
        try visitor.visitSingularBytesField(value: v, fieldNumber: 114)
      case nil: break
      }
      if let v = _storage._optionalLazyImportMessage {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 115)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_TestAllTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let other_storage = _args.1
        if _storage._optionalInt32 != other_storage._optionalInt32 {return false}
        if _storage._optionalInt64 != other_storage._optionalInt64 {return false}
        if _storage._optionalUint32 != other_storage._optionalUint32 {return false}
        if _storage._optionalUint64 != other_storage._optionalUint64 {return false}
        if _storage._optionalSint32 != other_storage._optionalSint32 {return false}
        if _storage._optionalSint64 != other_storage._optionalSint64 {return false}
        if _storage._optionalFixed32 != other_storage._optionalFixed32 {return false}
        if _storage._optionalFixed64 != other_storage._optionalFixed64 {return false}
        if _storage._optionalSfixed32 != other_storage._optionalSfixed32 {return false}
        if _storage._optionalSfixed64 != other_storage._optionalSfixed64 {return false}
        if _storage._optionalFloat != other_storage._optionalFloat {return false}
        if _storage._optionalDouble != other_storage._optionalDouble {return false}
        if _storage._optionalBool != other_storage._optionalBool {return false}
        if _storage._optionalString != other_storage._optionalString {return false}
        if _storage._optionalBytes != other_storage._optionalBytes {return false}
        if _storage._optionalNestedMessage != other_storage._optionalNestedMessage {return false}
        if _storage._optionalForeignMessage != other_storage._optionalForeignMessage {return false}
        if _storage._optionalImportMessage != other_storage._optionalImportMessage {return false}
        if _storage._optionalNestedEnum != other_storage._optionalNestedEnum {return false}
        if _storage._optionalForeignEnum != other_storage._optionalForeignEnum {return false}
        if _storage._optionalStringPiece != other_storage._optionalStringPiece {return false}
        if _storage._optionalCord != other_storage._optionalCord {return false}
        if _storage._optionalPublicImportMessage != other_storage._optionalPublicImportMessage {return false}
        if _storage._optionalLazyMessage != other_storage._optionalLazyMessage {return false}
        if _storage._optionalLazyImportMessage != other_storage._optionalLazyImportMessage {return false}
        if _storage._repeatedInt32 != other_storage._repeatedInt32 {return false}
        if _storage._repeatedInt64 != other_storage._repeatedInt64 {return false}
        if _storage._repeatedUint32 != other_storage._repeatedUint32 {return false}
        if _storage._repeatedUint64 != other_storage._repeatedUint64 {return false}
        if _storage._repeatedSint32 != other_storage._repeatedSint32 {return false}
        if _storage._repeatedSint64 != other_storage._repeatedSint64 {return false}
        if _storage._repeatedFixed32 != other_storage._repeatedFixed32 {return false}
        if _storage._repeatedFixed64 != other_storage._repeatedFixed64 {return false}
        if _storage._repeatedSfixed32 != other_storage._repeatedSfixed32 {return false}
        if _storage._repeatedSfixed64 != other_storage._repeatedSfixed64 {return false}
        if _storage._repeatedFloat != other_storage._repeatedFloat {return false}
        if _storage._repeatedDouble != other_storage._repeatedDouble {return false}
        if _storage._repeatedBool != other_storage._repeatedBool {return false}
        if _storage._repeatedString != other_storage._repeatedString {return false}
        if _storage._repeatedBytes != other_storage._repeatedBytes {return false}
        if _storage._repeatedNestedMessage != other_storage._repeatedNestedMessage {return false}
        if _storage._repeatedForeignMessage != other_storage._repeatedForeignMessage {return false}
        if _storage._repeatedImportMessage != other_storage._repeatedImportMessage {return false}
        if _storage._repeatedNestedEnum != other_storage._repeatedNestedEnum {return false}
        if _storage._repeatedForeignEnum != other_storage._repeatedForeignEnum {return false}
        if _storage._repeatedStringPiece != other_storage._repeatedStringPiece {return false}
        if _storage._repeatedCord != other_storage._repeatedCord {return false}
        if _storage._repeatedLazyMessage != other_storage._repeatedLazyMessage {return false}
        if _storage._oneofField != other_storage._oneofField {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_TestAllTypes.NestedEnum: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    -1: .same(proto: "NEG"),
    0: .same(proto: "ZERO"),
    1: .same(proto: "FOO"),
    2: .same(proto: "BAR"),
    3: .same(proto: "BAZ"),
  ]
}

extension Proto3Unittest_TestAllTypes.NestedMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = Proto3Unittest_TestAllTypes.protoMessageName + ".NestedMessage"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "bb"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularInt32Field(value: &self.bb)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if self.bb != 0 {
      try visitor.visitSingularInt32Field(value: self.bb, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_TestAllTypes.NestedMessage) -> Bool {
    if self.bb != other.bb {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_TestPackedTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".TestPackedTypes"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    90: .standard(proto: "packed_int32"),
    91: .standard(proto: "packed_int64"),
    92: .standard(proto: "packed_uint32"),
    93: .standard(proto: "packed_uint64"),
    94: .standard(proto: "packed_sint32"),
    95: .standard(proto: "packed_sint64"),
    96: .standard(proto: "packed_fixed32"),
    97: .standard(proto: "packed_fixed64"),
    98: .standard(proto: "packed_sfixed32"),
    99: .standard(proto: "packed_sfixed64"),
    100: .standard(proto: "packed_float"),
    101: .standard(proto: "packed_double"),
    102: .standard(proto: "packed_bool"),
    103: .standard(proto: "packed_enum"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 90: try decoder.decodeRepeatedInt32Field(value: &self.packedInt32)
      case 91: try decoder.decodeRepeatedInt64Field(value: &self.packedInt64)
      case 92: try decoder.decodeRepeatedUInt32Field(value: &self.packedUint32)
      case 93: try decoder.decodeRepeatedUInt64Field(value: &self.packedUint64)
      case 94: try decoder.decodeRepeatedSInt32Field(value: &self.packedSint32)
      case 95: try decoder.decodeRepeatedSInt64Field(value: &self.packedSint64)
      case 96: try decoder.decodeRepeatedFixed32Field(value: &self.packedFixed32)
      case 97: try decoder.decodeRepeatedFixed64Field(value: &self.packedFixed64)
      case 98: try decoder.decodeRepeatedSFixed32Field(value: &self.packedSfixed32)
      case 99: try decoder.decodeRepeatedSFixed64Field(value: &self.packedSfixed64)
      case 100: try decoder.decodeRepeatedFloatField(value: &self.packedFloat)
      case 101: try decoder.decodeRepeatedDoubleField(value: &self.packedDouble)
      case 102: try decoder.decodeRepeatedBoolField(value: &self.packedBool)
      case 103: try decoder.decodeRepeatedEnumField(value: &self.packedEnum)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.packedInt32.isEmpty {
      try visitor.visitPackedInt32Field(value: self.packedInt32, fieldNumber: 90)
    }
    if !self.packedInt64.isEmpty {
      try visitor.visitPackedInt64Field(value: self.packedInt64, fieldNumber: 91)
    }
    if !self.packedUint32.isEmpty {
      try visitor.visitPackedUInt32Field(value: self.packedUint32, fieldNumber: 92)
    }
    if !self.packedUint64.isEmpty {
      try visitor.visitPackedUInt64Field(value: self.packedUint64, fieldNumber: 93)
    }
    if !self.packedSint32.isEmpty {
      try visitor.visitPackedSInt32Field(value: self.packedSint32, fieldNumber: 94)
    }
    if !self.packedSint64.isEmpty {
      try visitor.visitPackedSInt64Field(value: self.packedSint64, fieldNumber: 95)
    }
    if !self.packedFixed32.isEmpty {
      try visitor.visitPackedFixed32Field(value: self.packedFixed32, fieldNumber: 96)
    }
    if !self.packedFixed64.isEmpty {
      try visitor.visitPackedFixed64Field(value: self.packedFixed64, fieldNumber: 97)
    }
    if !self.packedSfixed32.isEmpty {
      try visitor.visitPackedSFixed32Field(value: self.packedSfixed32, fieldNumber: 98)
    }
    if !self.packedSfixed64.isEmpty {
      try visitor.visitPackedSFixed64Field(value: self.packedSfixed64, fieldNumber: 99)
    }
    if !self.packedFloat.isEmpty {
      try visitor.visitPackedFloatField(value: self.packedFloat, fieldNumber: 100)
    }
    if !self.packedDouble.isEmpty {
      try visitor.visitPackedDoubleField(value: self.packedDouble, fieldNumber: 101)
    }
    if !self.packedBool.isEmpty {
      try visitor.visitPackedBoolField(value: self.packedBool, fieldNumber: 102)
    }
    if !self.packedEnum.isEmpty {
      try visitor.visitPackedEnumField(value: self.packedEnum, fieldNumber: 103)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_TestPackedTypes) -> Bool {
    if self.packedInt32 != other.packedInt32 {return false}
    if self.packedInt64 != other.packedInt64 {return false}
    if self.packedUint32 != other.packedUint32 {return false}
    if self.packedUint64 != other.packedUint64 {return false}
    if self.packedSint32 != other.packedSint32 {return false}
    if self.packedSint64 != other.packedSint64 {return false}
    if self.packedFixed32 != other.packedFixed32 {return false}
    if self.packedFixed64 != other.packedFixed64 {return false}
    if self.packedSfixed32 != other.packedSfixed32 {return false}
    if self.packedSfixed64 != other.packedSfixed64 {return false}
    if self.packedFloat != other.packedFloat {return false}
    if self.packedDouble != other.packedDouble {return false}
    if self.packedBool != other.packedBool {return false}
    if self.packedEnum != other.packedEnum {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_TestUnpackedTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".TestUnpackedTypes"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "repeated_int32"),
    2: .standard(proto: "repeated_int64"),
    3: .standard(proto: "repeated_uint32"),
    4: .standard(proto: "repeated_uint64"),
    5: .standard(proto: "repeated_sint32"),
    6: .standard(proto: "repeated_sint64"),
    7: .standard(proto: "repeated_fixed32"),
    8: .standard(proto: "repeated_fixed64"),
    9: .standard(proto: "repeated_sfixed32"),
    10: .standard(proto: "repeated_sfixed64"),
    11: .standard(proto: "repeated_float"),
    12: .standard(proto: "repeated_double"),
    13: .standard(proto: "repeated_bool"),
    14: .standard(proto: "repeated_nested_enum"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeRepeatedInt32Field(value: &self.repeatedInt32)
      case 2: try decoder.decodeRepeatedInt64Field(value: &self.repeatedInt64)
      case 3: try decoder.decodeRepeatedUInt32Field(value: &self.repeatedUint32)
      case 4: try decoder.decodeRepeatedUInt64Field(value: &self.repeatedUint64)
      case 5: try decoder.decodeRepeatedSInt32Field(value: &self.repeatedSint32)
      case 6: try decoder.decodeRepeatedSInt64Field(value: &self.repeatedSint64)
      case 7: try decoder.decodeRepeatedFixed32Field(value: &self.repeatedFixed32)
      case 8: try decoder.decodeRepeatedFixed64Field(value: &self.repeatedFixed64)
      case 9: try decoder.decodeRepeatedSFixed32Field(value: &self.repeatedSfixed32)
      case 10: try decoder.decodeRepeatedSFixed64Field(value: &self.repeatedSfixed64)
      case 11: try decoder.decodeRepeatedFloatField(value: &self.repeatedFloat)
      case 12: try decoder.decodeRepeatedDoubleField(value: &self.repeatedDouble)
      case 13: try decoder.decodeRepeatedBoolField(value: &self.repeatedBool)
      case 14: try decoder.decodeRepeatedEnumField(value: &self.repeatedNestedEnum)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.repeatedInt32.isEmpty {
      try visitor.visitRepeatedInt32Field(value: self.repeatedInt32, fieldNumber: 1)
    }
    if !self.repeatedInt64.isEmpty {
      try visitor.visitRepeatedInt64Field(value: self.repeatedInt64, fieldNumber: 2)
    }
    if !self.repeatedUint32.isEmpty {
      try visitor.visitRepeatedUInt32Field(value: self.repeatedUint32, fieldNumber: 3)
    }
    if !self.repeatedUint64.isEmpty {
      try visitor.visitRepeatedUInt64Field(value: self.repeatedUint64, fieldNumber: 4)
    }
    if !self.repeatedSint32.isEmpty {
      try visitor.visitRepeatedSInt32Field(value: self.repeatedSint32, fieldNumber: 5)
    }
    if !self.repeatedSint64.isEmpty {
      try visitor.visitRepeatedSInt64Field(value: self.repeatedSint64, fieldNumber: 6)
    }
    if !self.repeatedFixed32.isEmpty {
      try visitor.visitRepeatedFixed32Field(value: self.repeatedFixed32, fieldNumber: 7)
    }
    if !self.repeatedFixed64.isEmpty {
      try visitor.visitRepeatedFixed64Field(value: self.repeatedFixed64, fieldNumber: 8)
    }
    if !self.repeatedSfixed32.isEmpty {
      try visitor.visitRepeatedSFixed32Field(value: self.repeatedSfixed32, fieldNumber: 9)
    }
    if !self.repeatedSfixed64.isEmpty {
      try visitor.visitRepeatedSFixed64Field(value: self.repeatedSfixed64, fieldNumber: 10)
    }
    if !self.repeatedFloat.isEmpty {
      try visitor.visitRepeatedFloatField(value: self.repeatedFloat, fieldNumber: 11)
    }
    if !self.repeatedDouble.isEmpty {
      try visitor.visitRepeatedDoubleField(value: self.repeatedDouble, fieldNumber: 12)
    }
    if !self.repeatedBool.isEmpty {
      try visitor.visitRepeatedBoolField(value: self.repeatedBool, fieldNumber: 13)
    }
    if !self.repeatedNestedEnum.isEmpty {
      try visitor.visitRepeatedEnumField(value: self.repeatedNestedEnum, fieldNumber: 14)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_TestUnpackedTypes) -> Bool {
    if self.repeatedInt32 != other.repeatedInt32 {return false}
    if self.repeatedInt64 != other.repeatedInt64 {return false}
    if self.repeatedUint32 != other.repeatedUint32 {return false}
    if self.repeatedUint64 != other.repeatedUint64 {return false}
    if self.repeatedSint32 != other.repeatedSint32 {return false}
    if self.repeatedSint64 != other.repeatedSint64 {return false}
    if self.repeatedFixed32 != other.repeatedFixed32 {return false}
    if self.repeatedFixed64 != other.repeatedFixed64 {return false}
    if self.repeatedSfixed32 != other.repeatedSfixed32 {return false}
    if self.repeatedSfixed64 != other.repeatedSfixed64 {return false}
    if self.repeatedFloat != other.repeatedFloat {return false}
    if self.repeatedDouble != other.repeatedDouble {return false}
    if self.repeatedBool != other.repeatedBool {return false}
    if self.repeatedNestedEnum != other.repeatedNestedEnum {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_NestedTestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".NestedTestAllTypes"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "child"),
    2: .same(proto: "payload"),
  ]

  fileprivate class _StorageClass {
    var _child: Proto3Unittest_NestedTestAllTypes? = nil
    var _payload: Proto3Unittest_TestAllTypes? = nil

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _child = source._child
      _payload = source._payload
    }
  }

  fileprivate mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _StorageClass(copying: _storage)
    }
    return _storage
  }

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    _ = _uniqueStorage()
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      while let fieldNumber = try decoder.nextFieldNumber() {
        switch fieldNumber {
        case 1: try decoder.decodeSingularMessageField(value: &_storage._child)
        case 2: try decoder.decodeSingularMessageField(value: &_storage._payload)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if let v = _storage._child {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
      }
      if let v = _storage._payload {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_NestedTestAllTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let other_storage = _args.1
        if _storage._child != other_storage._child {return false}
        if _storage._payload != other_storage._payload {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_ForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".ForeignMessage"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "c"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularInt32Field(value: &self.c)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if self.c != 0 {
      try visitor.visitSingularInt32Field(value: self.c, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_ForeignMessage) -> Bool {
    if self.c != other.c {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Proto3Unittest_TestEmptyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".TestEmptyMessage"
  static let _protobuf_nameMap = SwiftProtobuf._NameMap()

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let _ = try decoder.nextFieldNumber() {
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try unknownFields.traverse(visitor: &visitor)
  }

  func _protobuf_generated_isEqualTo(other: Proto3Unittest_TestEmptyMessage) -> Bool {
    if unknownFields != other.unknownFields {return false}
    return true
  }
}
