/*
 * DO NOT EDIT.
 *
 * Generated by the protocol buffer compiler.
 * Source: google/protobuf/unittest_well_known_types.proto
 *
 */

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 _1: SwiftProtobuf.ProtobufAPIVersion_1 {}
  typealias Version = _1
}

/// Test that we can include all well-known types.
/// Each wrapper type is included separately, as languages
/// map handle different wrappers in different ways.
struct ProtobufUnittest_TestWellKnownTypes: SwiftProtobuf.Message {
  static let protoMessageName: String = _protobuf_package + ".TestWellKnownTypes"

  var anyField: Google_Protobuf_Any {
    get {return _storage._anyField ?? Google_Protobuf_Any()}
    set {_uniqueStorage()._anyField = newValue}
  }
  var hasAnyField: Bool {
    return _storage._anyField != nil
  }
  mutating func clearAnyField() {
    _storage._anyField = nil
  }

  var apiField: Google_Protobuf_Api {
    get {return _storage._apiField ?? Google_Protobuf_Api()}
    set {_uniqueStorage()._apiField = newValue}
  }
  var hasApiField: Bool {
    return _storage._apiField != nil
  }
  mutating func clearApiField() {
    _storage._apiField = nil
  }

  var durationField: Google_Protobuf_Duration {
    get {return _storage._durationField ?? Google_Protobuf_Duration()}
    set {_uniqueStorage()._durationField = newValue}
  }
  var hasDurationField: Bool {
    return _storage._durationField != nil
  }
  mutating func clearDurationField() {
    _storage._durationField = nil
  }

  var emptyField: Google_Protobuf_Empty {
    get {return _storage._emptyField ?? Google_Protobuf_Empty()}
    set {_uniqueStorage()._emptyField = newValue}
  }
  var hasEmptyField: Bool {
    return _storage._emptyField != nil
  }
  mutating func clearEmptyField() {
    _storage._emptyField = nil
  }

  var fieldMaskField: Google_Protobuf_FieldMask {
    get {return _storage._fieldMaskField ?? Google_Protobuf_FieldMask()}
    set {_uniqueStorage()._fieldMaskField = newValue}
  }
  var hasFieldMaskField: Bool {
    return _storage._fieldMaskField != nil
  }
  mutating func clearFieldMaskField() {
    _storage._fieldMaskField = nil
  }

  var sourceContextField: Google_Protobuf_SourceContext {
    get {return _storage._sourceContextField ?? Google_Protobuf_SourceContext()}
    set {_uniqueStorage()._sourceContextField = newValue}
  }
  var hasSourceContextField: Bool {
    return _storage._sourceContextField != nil
  }
  mutating func clearSourceContextField() {
    _storage._sourceContextField = nil
  }

  var structField: Google_Protobuf_Struct {
    get {return _storage._structField ?? Google_Protobuf_Struct()}
    set {_uniqueStorage()._structField = newValue}
  }
  var hasStructField: Bool {
    return _storage._structField != nil
  }
  mutating func clearStructField() {
    _storage._structField = nil
  }

  var timestampField: Google_Protobuf_Timestamp {
    get {return _storage._timestampField ?? Google_Protobuf_Timestamp()}
    set {_uniqueStorage()._timestampField = newValue}
  }
  var hasTimestampField: Bool {
    return _storage._timestampField != nil
  }
  mutating func clearTimestampField() {
    _storage._timestampField = nil
  }

  var typeField: Google_Protobuf_Type {
    get {return _storage._typeField ?? Google_Protobuf_Type()}
    set {_uniqueStorage()._typeField = newValue}
  }
  var hasTypeField: Bool {
    return _storage._typeField != nil
  }
  mutating func clearTypeField() {
    _storage._typeField = nil
  }

  var doubleField: Google_Protobuf_DoubleValue {
    get {return _storage._doubleField ?? Google_Protobuf_DoubleValue()}
    set {_uniqueStorage()._doubleField = newValue}
  }
  var hasDoubleField: Bool {
    return _storage._doubleField != nil
  }
  mutating func clearDoubleField() {
    _storage._doubleField = nil
  }

  var floatField: Google_Protobuf_FloatValue {
    get {return _storage._floatField ?? Google_Protobuf_FloatValue()}
    set {_uniqueStorage()._floatField = newValue}
  }
  var hasFloatField: Bool {
    return _storage._floatField != nil
  }
  mutating func clearFloatField() {
    _storage._floatField = nil
  }

  var int64Field: Google_Protobuf_Int64Value {
    get {return _storage._int64Field ?? Google_Protobuf_Int64Value()}
    set {_uniqueStorage()._int64Field = newValue}
  }
  var hasInt64Field: Bool {
    return _storage._int64Field != nil
  }
  mutating func clearInt64Field() {
    _storage._int64Field = nil
  }

  var uint64Field: Google_Protobuf_UInt64Value {
    get {return _storage._uint64Field ?? Google_Protobuf_UInt64Value()}
    set {_uniqueStorage()._uint64Field = newValue}
  }
  var hasUint64Field: Bool {
    return _storage._uint64Field != nil
  }
  mutating func clearUint64Field() {
    _storage._uint64Field = nil
  }

  var int32Field: Google_Protobuf_Int32Value {
    get {return _storage._int32Field ?? Google_Protobuf_Int32Value()}
    set {_uniqueStorage()._int32Field = newValue}
  }
  var hasInt32Field: Bool {
    return _storage._int32Field != nil
  }
  mutating func clearInt32Field() {
    _storage._int32Field = nil
  }

  var uint32Field: Google_Protobuf_UInt32Value {
    get {return _storage._uint32Field ?? Google_Protobuf_UInt32Value()}
    set {_uniqueStorage()._uint32Field = newValue}
  }
  var hasUint32Field: Bool {
    return _storage._uint32Field != nil
  }
  mutating func clearUint32Field() {
    _storage._uint32Field = nil
  }

  var boolField: Google_Protobuf_BoolValue {
    get {return _storage._boolField ?? Google_Protobuf_BoolValue()}
    set {_uniqueStorage()._boolField = newValue}
  }
  var hasBoolField: Bool {
    return _storage._boolField != nil
  }
  mutating func clearBoolField() {
    _storage._boolField = nil
  }

  var stringField: Google_Protobuf_StringValue {
    get {return _storage._stringField ?? Google_Protobuf_StringValue()}
    set {_uniqueStorage()._stringField = newValue}
  }
  var hasStringField: Bool {
    return _storage._stringField != nil
  }
  mutating func clearStringField() {
    _storage._stringField = nil
  }

  var bytesField: Google_Protobuf_BytesValue {
    get {return _storage._bytesField ?? Google_Protobuf_BytesValue()}
    set {_uniqueStorage()._bytesField = newValue}
  }
  var hasBytesField: Bool {
    return _storage._bytesField != nil
  }
  mutating func clearBytesField() {
    _storage._bytesField = nil
  }

  /// Part of struct, but useful to be able to test separately
  var valueField: Google_Protobuf_Value {
    get {return _storage._valueField ?? Google_Protobuf_Value()}
    set {_uniqueStorage()._valueField = newValue}
  }
  var hasValueField: Bool {
    return _storage._valueField != nil
  }
  mutating func clearValueField() {
    _storage._valueField = nil
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  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._anyField)
        case 2: try decoder.decodeSingularMessageField(value: &_storage._apiField)
        case 3: try decoder.decodeSingularMessageField(value: &_storage._durationField)
        case 4: try decoder.decodeSingularMessageField(value: &_storage._emptyField)
        case 5: try decoder.decodeSingularMessageField(value: &_storage._fieldMaskField)
        case 6: try decoder.decodeSingularMessageField(value: &_storage._sourceContextField)
        case 7: try decoder.decodeSingularMessageField(value: &_storage._structField)
        case 8: try decoder.decodeSingularMessageField(value: &_storage._timestampField)
        case 9: try decoder.decodeSingularMessageField(value: &_storage._typeField)
        case 10: try decoder.decodeSingularMessageField(value: &_storage._doubleField)
        case 11: try decoder.decodeSingularMessageField(value: &_storage._floatField)
        case 12: try decoder.decodeSingularMessageField(value: &_storage._int64Field)
        case 13: try decoder.decodeSingularMessageField(value: &_storage._uint64Field)
        case 14: try decoder.decodeSingularMessageField(value: &_storage._int32Field)
        case 15: try decoder.decodeSingularMessageField(value: &_storage._uint32Field)
        case 16: try decoder.decodeSingularMessageField(value: &_storage._boolField)
        case 17: try decoder.decodeSingularMessageField(value: &_storage._stringField)
        case 18: try decoder.decodeSingularMessageField(value: &_storage._bytesField)
        case 19: try decoder.decodeSingularMessageField(value: &_storage._valueField)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if let v = _storage._anyField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
      }
      if let v = _storage._apiField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      }
      if let v = _storage._durationField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      }
      if let v = _storage._emptyField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      }
      if let v = _storage._fieldMaskField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
      }
      if let v = _storage._sourceContextField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
      }
      if let v = _storage._structField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
      }
      if let v = _storage._timestampField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
      }
      if let v = _storage._typeField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
      }
      if let v = _storage._doubleField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
      }
      if let v = _storage._floatField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
      }
      if let v = _storage._int64Field {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
      }
      if let v = _storage._uint64Field {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 13)
      }
      if let v = _storage._int32Field {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 14)
      }
      if let v = _storage._uint32Field {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 15)
      }
      if let v = _storage._boolField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 16)
      }
      if let v = _storage._stringField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 17)
      }
      if let v = _storage._bytesField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
      }
      if let v = _storage._valueField {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  fileprivate var _storage = _StorageClass()
}

/// A repeated field for each well-known type.
struct ProtobufUnittest_RepeatedWellKnownTypes: SwiftProtobuf.Message {
  static let protoMessageName: String = _protobuf_package + ".RepeatedWellKnownTypes"

  var anyField: [Google_Protobuf_Any] {
    get {return _storage._anyField}
    set {_uniqueStorage()._anyField = newValue}
  }

  var apiField: [Google_Protobuf_Api] {
    get {return _storage._apiField}
    set {_uniqueStorage()._apiField = newValue}
  }

  var durationField: [Google_Protobuf_Duration] {
    get {return _storage._durationField}
    set {_uniqueStorage()._durationField = newValue}
  }

  var emptyField: [Google_Protobuf_Empty] {
    get {return _storage._emptyField}
    set {_uniqueStorage()._emptyField = newValue}
  }

  var fieldMaskField: [Google_Protobuf_FieldMask] {
    get {return _storage._fieldMaskField}
    set {_uniqueStorage()._fieldMaskField = newValue}
  }

  var sourceContextField: [Google_Protobuf_SourceContext] {
    get {return _storage._sourceContextField}
    set {_uniqueStorage()._sourceContextField = newValue}
  }

  var structField: [Google_Protobuf_Struct] {
    get {return _storage._structField}
    set {_uniqueStorage()._structField = newValue}
  }

  var timestampField: [Google_Protobuf_Timestamp] {
    get {return _storage._timestampField}
    set {_uniqueStorage()._timestampField = newValue}
  }

  var typeField: [Google_Protobuf_Type] {
    get {return _storage._typeField}
    set {_uniqueStorage()._typeField = newValue}
  }

  /// These don't actually make a lot of sense, but they're not prohibited...
  var doubleField: [Google_Protobuf_DoubleValue] {
    get {return _storage._doubleField}
    set {_uniqueStorage()._doubleField = newValue}
  }

  var floatField: [Google_Protobuf_FloatValue] {
    get {return _storage._floatField}
    set {_uniqueStorage()._floatField = newValue}
  }

  var int64Field: [Google_Protobuf_Int64Value] {
    get {return _storage._int64Field}
    set {_uniqueStorage()._int64Field = newValue}
  }

  var uint64Field: [Google_Protobuf_UInt64Value] {
    get {return _storage._uint64Field}
    set {_uniqueStorage()._uint64Field = newValue}
  }

  var int32Field: [Google_Protobuf_Int32Value] {
    get {return _storage._int32Field}
    set {_uniqueStorage()._int32Field = newValue}
  }

  var uint32Field: [Google_Protobuf_UInt32Value] {
    get {return _storage._uint32Field}
    set {_uniqueStorage()._uint32Field = newValue}
  }

  var boolField: [Google_Protobuf_BoolValue] {
    get {return _storage._boolField}
    set {_uniqueStorage()._boolField = newValue}
  }

  var stringField: [Google_Protobuf_StringValue] {
    get {return _storage._stringField}
    set {_uniqueStorage()._stringField = newValue}
  }

  var bytesField: [Google_Protobuf_BytesValue] {
    get {return _storage._bytesField}
    set {_uniqueStorage()._bytesField = newValue}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  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.decodeRepeatedMessageField(value: &_storage._anyField)
        case 2: try decoder.decodeRepeatedMessageField(value: &_storage._apiField)
        case 3: try decoder.decodeRepeatedMessageField(value: &_storage._durationField)
        case 4: try decoder.decodeRepeatedMessageField(value: &_storage._emptyField)
        case 5: try decoder.decodeRepeatedMessageField(value: &_storage._fieldMaskField)
        case 6: try decoder.decodeRepeatedMessageField(value: &_storage._sourceContextField)
        case 7: try decoder.decodeRepeatedMessageField(value: &_storage._structField)
        case 8: try decoder.decodeRepeatedMessageField(value: &_storage._timestampField)
        case 9: try decoder.decodeRepeatedMessageField(value: &_storage._typeField)
        case 10: try decoder.decodeRepeatedMessageField(value: &_storage._doubleField)
        case 11: try decoder.decodeRepeatedMessageField(value: &_storage._floatField)
        case 12: try decoder.decodeRepeatedMessageField(value: &_storage._int64Field)
        case 13: try decoder.decodeRepeatedMessageField(value: &_storage._uint64Field)
        case 14: try decoder.decodeRepeatedMessageField(value: &_storage._int32Field)
        case 15: try decoder.decodeRepeatedMessageField(value: &_storage._uint32Field)
        case 16: try decoder.decodeRepeatedMessageField(value: &_storage._boolField)
        case 17: try decoder.decodeRepeatedMessageField(value: &_storage._stringField)
        case 18: try decoder.decodeRepeatedMessageField(value: &_storage._bytesField)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if !_storage._anyField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._anyField, fieldNumber: 1)
      }
      if !_storage._apiField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._apiField, fieldNumber: 2)
      }
      if !_storage._durationField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._durationField, fieldNumber: 3)
      }
      if !_storage._emptyField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._emptyField, fieldNumber: 4)
      }
      if !_storage._fieldMaskField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._fieldMaskField, fieldNumber: 5)
      }
      if !_storage._sourceContextField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._sourceContextField, fieldNumber: 6)
      }
      if !_storage._structField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._structField, fieldNumber: 7)
      }
      if !_storage._timestampField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._timestampField, fieldNumber: 8)
      }
      if !_storage._typeField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._typeField, fieldNumber: 9)
      }
      if !_storage._doubleField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._doubleField, fieldNumber: 10)
      }
      if !_storage._floatField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._floatField, fieldNumber: 11)
      }
      if !_storage._int64Field.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._int64Field, fieldNumber: 12)
      }
      if !_storage._uint64Field.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._uint64Field, fieldNumber: 13)
      }
      if !_storage._int32Field.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._int32Field, fieldNumber: 14)
      }
      if !_storage._uint32Field.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._uint32Field, fieldNumber: 15)
      }
      if !_storage._boolField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._boolField, fieldNumber: 16)
      }
      if !_storage._stringField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._stringField, fieldNumber: 17)
      }
      if !_storage._bytesField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._bytesField, fieldNumber: 18)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  fileprivate var _storage = _StorageClass()
}

struct ProtobufUnittest_OneofWellKnownTypes: SwiftProtobuf.Message {
  static let protoMessageName: String = _protobuf_package + ".OneofWellKnownTypes"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum OneOf_OneofField: Equatable {
    case anyField(Google_Protobuf_Any)
    case apiField(Google_Protobuf_Api)
    case durationField(Google_Protobuf_Duration)
    case emptyField(Google_Protobuf_Empty)
    case fieldMaskField(Google_Protobuf_FieldMask)
    case sourceContextField(Google_Protobuf_SourceContext)
    case structField(Google_Protobuf_Struct)
    case timestampField(Google_Protobuf_Timestamp)
    case typeField(Google_Protobuf_Type)
    case doubleField(Google_Protobuf_DoubleValue)
    case floatField(Google_Protobuf_FloatValue)
    case int64Field(Google_Protobuf_Int64Value)
    case uint64Field(Google_Protobuf_UInt64Value)
    case int32Field(Google_Protobuf_Int32Value)
    case uint32Field(Google_Protobuf_UInt32Value)
    case boolField(Google_Protobuf_BoolValue)
    case stringField(Google_Protobuf_StringValue)
    case bytesField(Google_Protobuf_BytesValue)

    static func ==(lhs: ProtobufUnittest_OneofWellKnownTypes.OneOf_OneofField, rhs: ProtobufUnittest_OneofWellKnownTypes.OneOf_OneofField) -> Bool {
      switch (lhs, rhs) {
      case (.anyField(let l), .anyField(let r)): return l == r
      case (.apiField(let l), .apiField(let r)): return l == r
      case (.durationField(let l), .durationField(let r)): return l == r
      case (.emptyField(let l), .emptyField(let r)): return l == r
      case (.fieldMaskField(let l), .fieldMaskField(let r)): return l == r
      case (.sourceContextField(let l), .sourceContextField(let r)): return l == r
      case (.structField(let l), .structField(let r)): return l == r
      case (.timestampField(let l), .timestampField(let r)): return l == r
      case (.typeField(let l), .typeField(let r)): return l == r
      case (.doubleField(let l), .doubleField(let r)): return l == r
      case (.floatField(let l), .floatField(let r)): return l == r
      case (.int64Field(let l), .int64Field(let r)): return l == r
      case (.uint64Field(let l), .uint64Field(let r)): return l == r
      case (.int32Field(let l), .int32Field(let r)): return l == r
      case (.uint32Field(let l), .uint32Field(let r)): return l == r
      case (.boolField(let l), .boolField(let r)): return l == r
      case (.stringField(let l), .stringField(let r)): return l == r
      case (.bytesField(let l), .bytesField(let r)): return l == r
      default: return false
      }
    }
  }

  init() {}

  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...18:
          if _storage._oneofField != nil {
            try decoder.handleConflictingOneOf()
          }
          _storage._oneofField = try ProtobufUnittest_OneofWellKnownTypes.OneOf_OneofField(byDecodingFrom: &decoder, fieldNumber: fieldNumber)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      try _storage._oneofField?.traverse(visitor: &visitor)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  fileprivate var _storage = _StorageClass()
}

/// A map field for each well-known type. We only
/// need to worry about the value part of the map being the
/// well-known types, as messages can't be map keys.
struct ProtobufUnittest_MapWellKnownTypes: SwiftProtobuf.Message {
  static let protoMessageName: String = _protobuf_package + ".MapWellKnownTypes"

  var anyField: Dictionary<Int32,Google_Protobuf_Any> {
    get {return _storage._anyField}
    set {_uniqueStorage()._anyField = newValue}
  }

  var apiField: Dictionary<Int32,Google_Protobuf_Api> {
    get {return _storage._apiField}
    set {_uniqueStorage()._apiField = newValue}
  }

  var durationField: Dictionary<Int32,Google_Protobuf_Duration> {
    get {return _storage._durationField}
    set {_uniqueStorage()._durationField = newValue}
  }

  var emptyField: Dictionary<Int32,Google_Protobuf_Empty> {
    get {return _storage._emptyField}
    set {_uniqueStorage()._emptyField = newValue}
  }

  var fieldMaskField: Dictionary<Int32,Google_Protobuf_FieldMask> {
    get {return _storage._fieldMaskField}
    set {_uniqueStorage()._fieldMaskField = newValue}
  }

  var sourceContextField: Dictionary<Int32,Google_Protobuf_SourceContext> {
    get {return _storage._sourceContextField}
    set {_uniqueStorage()._sourceContextField = newValue}
  }

  var structField: Dictionary<Int32,Google_Protobuf_Struct> {
    get {return _storage._structField}
    set {_uniqueStorage()._structField = newValue}
  }

  var timestampField: Dictionary<Int32,Google_Protobuf_Timestamp> {
    get {return _storage._timestampField}
    set {_uniqueStorage()._timestampField = newValue}
  }

  var typeField: Dictionary<Int32,Google_Protobuf_Type> {
    get {return _storage._typeField}
    set {_uniqueStorage()._typeField = newValue}
  }

  var doubleField: Dictionary<Int32,Google_Protobuf_DoubleValue> {
    get {return _storage._doubleField}
    set {_uniqueStorage()._doubleField = newValue}
  }

  var floatField: Dictionary<Int32,Google_Protobuf_FloatValue> {
    get {return _storage._floatField}
    set {_uniqueStorage()._floatField = newValue}
  }

  var int64Field: Dictionary<Int32,Google_Protobuf_Int64Value> {
    get {return _storage._int64Field}
    set {_uniqueStorage()._int64Field = newValue}
  }

  var uint64Field: Dictionary<Int32,Google_Protobuf_UInt64Value> {
    get {return _storage._uint64Field}
    set {_uniqueStorage()._uint64Field = newValue}
  }

  var int32Field: Dictionary<Int32,Google_Protobuf_Int32Value> {
    get {return _storage._int32Field}
    set {_uniqueStorage()._int32Field = newValue}
  }

  var uint32Field: Dictionary<Int32,Google_Protobuf_UInt32Value> {
    get {return _storage._uint32Field}
    set {_uniqueStorage()._uint32Field = newValue}
  }

  var boolField: Dictionary<Int32,Google_Protobuf_BoolValue> {
    get {return _storage._boolField}
    set {_uniqueStorage()._boolField = newValue}
  }

  var stringField: Dictionary<Int32,Google_Protobuf_StringValue> {
    get {return _storage._stringField}
    set {_uniqueStorage()._stringField = newValue}
  }

  var bytesField: Dictionary<Int32,Google_Protobuf_BytesValue> {
    get {return _storage._bytesField}
    set {_uniqueStorage()._bytesField = newValue}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  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.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Any>.self, value: &_storage._anyField)
        case 2: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Api>.self, value: &_storage._apiField)
        case 3: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Duration>.self, value: &_storage._durationField)
        case 4: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Empty>.self, value: &_storage._emptyField)
        case 5: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_FieldMask>.self, value: &_storage._fieldMaskField)
        case 6: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_SourceContext>.self, value: &_storage._sourceContextField)
        case 7: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Struct>.self, value: &_storage._structField)
        case 8: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Timestamp>.self, value: &_storage._timestampField)
        case 9: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Type>.self, value: &_storage._typeField)
        case 10: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_DoubleValue>.self, value: &_storage._doubleField)
        case 11: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_FloatValue>.self, value: &_storage._floatField)
        case 12: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Int64Value>.self, value: &_storage._int64Field)
        case 13: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_UInt64Value>.self, value: &_storage._uint64Field)
        case 14: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Int32Value>.self, value: &_storage._int32Field)
        case 15: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_UInt32Value>.self, value: &_storage._uint32Field)
        case 16: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_BoolValue>.self, value: &_storage._boolField)
        case 17: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_StringValue>.self, value: &_storage._stringField)
        case 18: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_BytesValue>.self, value: &_storage._bytesField)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if !_storage._anyField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Any>.self, value: _storage._anyField, fieldNumber: 1)
      }
      if !_storage._apiField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Api>.self, value: _storage._apiField, fieldNumber: 2)
      }
      if !_storage._durationField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Duration>.self, value: _storage._durationField, fieldNumber: 3)
      }
      if !_storage._emptyField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Empty>.self, value: _storage._emptyField, fieldNumber: 4)
      }
      if !_storage._fieldMaskField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_FieldMask>.self, value: _storage._fieldMaskField, fieldNumber: 5)
      }
      if !_storage._sourceContextField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_SourceContext>.self, value: _storage._sourceContextField, fieldNumber: 6)
      }
      if !_storage._structField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Struct>.self, value: _storage._structField, fieldNumber: 7)
      }
      if !_storage._timestampField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Timestamp>.self, value: _storage._timestampField, fieldNumber: 8)
      }
      if !_storage._typeField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Type>.self, value: _storage._typeField, fieldNumber: 9)
      }
      if !_storage._doubleField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_DoubleValue>.self, value: _storage._doubleField, fieldNumber: 10)
      }
      if !_storage._floatField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_FloatValue>.self, value: _storage._floatField, fieldNumber: 11)
      }
      if !_storage._int64Field.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Int64Value>.self, value: _storage._int64Field, fieldNumber: 12)
      }
      if !_storage._uint64Field.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_UInt64Value>.self, value: _storage._uint64Field, fieldNumber: 13)
      }
      if !_storage._int32Field.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_Int32Value>.self, value: _storage._int32Field, fieldNumber: 14)
      }
      if !_storage._uint32Field.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_UInt32Value>.self, value: _storage._uint32Field, fieldNumber: 15)
      }
      if !_storage._boolField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_BoolValue>.self, value: _storage._boolField, fieldNumber: 16)
      }
      if !_storage._stringField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_StringValue>.self, value: _storage._stringField, fieldNumber: 17)
      }
      if !_storage._bytesField.isEmpty {
        try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Google_Protobuf_BytesValue>.self, value: _storage._bytesField, fieldNumber: 18)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  fileprivate var _storage = _StorageClass()
}

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

fileprivate let _protobuf_package = "protobuf_unittest"

extension ProtobufUnittest_TestWellKnownTypes: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "any_field"),
    2: .standard(proto: "api_field"),
    3: .standard(proto: "duration_field"),
    4: .standard(proto: "empty_field"),
    5: .standard(proto: "field_mask_field"),
    6: .standard(proto: "source_context_field"),
    7: .standard(proto: "struct_field"),
    8: .standard(proto: "timestamp_field"),
    9: .standard(proto: "type_field"),
    10: .standard(proto: "double_field"),
    11: .standard(proto: "float_field"),
    12: .standard(proto: "int64_field"),
    13: .standard(proto: "uint64_field"),
    14: .standard(proto: "int32_field"),
    15: .standard(proto: "uint32_field"),
    16: .standard(proto: "bool_field"),
    17: .standard(proto: "string_field"),
    18: .standard(proto: "bytes_field"),
    19: .standard(proto: "value_field"),
  ]

  fileprivate class _StorageClass {
    var _anyField: Google_Protobuf_Any? = nil
    var _apiField: Google_Protobuf_Api? = nil
    var _durationField: Google_Protobuf_Duration? = nil
    var _emptyField: Google_Protobuf_Empty? = nil
    var _fieldMaskField: Google_Protobuf_FieldMask? = nil
    var _sourceContextField: Google_Protobuf_SourceContext? = nil
    var _structField: Google_Protobuf_Struct? = nil
    var _timestampField: Google_Protobuf_Timestamp? = nil
    var _typeField: Google_Protobuf_Type? = nil
    var _doubleField: Google_Protobuf_DoubleValue? = nil
    var _floatField: Google_Protobuf_FloatValue? = nil
    var _int64Field: Google_Protobuf_Int64Value? = nil
    var _uint64Field: Google_Protobuf_UInt64Value? = nil
    var _int32Field: Google_Protobuf_Int32Value? = nil
    var _uint32Field: Google_Protobuf_UInt32Value? = nil
    var _boolField: Google_Protobuf_BoolValue? = nil
    var _stringField: Google_Protobuf_StringValue? = nil
    var _bytesField: Google_Protobuf_BytesValue? = nil
    var _valueField: Google_Protobuf_Value? = nil

    init() {}

    init(copying source: _StorageClass) {
      _anyField = source._anyField
      _apiField = source._apiField
      _durationField = source._durationField
      _emptyField = source._emptyField
      _fieldMaskField = source._fieldMaskField
      _sourceContextField = source._sourceContextField
      _structField = source._structField
      _timestampField = source._timestampField
      _typeField = source._typeField
      _doubleField = source._doubleField
      _floatField = source._floatField
      _int64Field = source._int64Field
      _uint64Field = source._uint64Field
      _int32Field = source._int32Field
      _uint32Field = source._uint32Field
      _boolField = source._boolField
      _stringField = source._stringField
      _bytesField = source._bytesField
      _valueField = source._valueField
    }
  }

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

  func _protobuf_generated_isEqualTo(other: ProtobufUnittest_TestWellKnownTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
        if _storage._anyField != other_storage._anyField {return false}
        if _storage._apiField != other_storage._apiField {return false}
        if _storage._durationField != other_storage._durationField {return false}
        if _storage._emptyField != other_storage._emptyField {return false}
        if _storage._fieldMaskField != other_storage._fieldMaskField {return false}
        if _storage._sourceContextField != other_storage._sourceContextField {return false}
        if _storage._structField != other_storage._structField {return false}
        if _storage._timestampField != other_storage._timestampField {return false}
        if _storage._typeField != other_storage._typeField {return false}
        if _storage._doubleField != other_storage._doubleField {return false}
        if _storage._floatField != other_storage._floatField {return false}
        if _storage._int64Field != other_storage._int64Field {return false}
        if _storage._uint64Field != other_storage._uint64Field {return false}
        if _storage._int32Field != other_storage._int32Field {return false}
        if _storage._uint32Field != other_storage._uint32Field {return false}
        if _storage._boolField != other_storage._boolField {return false}
        if _storage._stringField != other_storage._stringField {return false}
        if _storage._bytesField != other_storage._bytesField {return false}
        if _storage._valueField != other_storage._valueField {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension ProtobufUnittest_RepeatedWellKnownTypes: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "any_field"),
    2: .standard(proto: "api_field"),
    3: .standard(proto: "duration_field"),
    4: .standard(proto: "empty_field"),
    5: .standard(proto: "field_mask_field"),
    6: .standard(proto: "source_context_field"),
    7: .standard(proto: "struct_field"),
    8: .standard(proto: "timestamp_field"),
    9: .standard(proto: "type_field"),
    10: .standard(proto: "double_field"),
    11: .standard(proto: "float_field"),
    12: .standard(proto: "int64_field"),
    13: .standard(proto: "uint64_field"),
    14: .standard(proto: "int32_field"),
    15: .standard(proto: "uint32_field"),
    16: .standard(proto: "bool_field"),
    17: .standard(proto: "string_field"),
    18: .standard(proto: "bytes_field"),
  ]

  fileprivate class _StorageClass {
    var _anyField: [Google_Protobuf_Any] = []
    var _apiField: [Google_Protobuf_Api] = []
    var _durationField: [Google_Protobuf_Duration] = []
    var _emptyField: [Google_Protobuf_Empty] = []
    var _fieldMaskField: [Google_Protobuf_FieldMask] = []
    var _sourceContextField: [Google_Protobuf_SourceContext] = []
    var _structField: [Google_Protobuf_Struct] = []
    var _timestampField: [Google_Protobuf_Timestamp] = []
    var _typeField: [Google_Protobuf_Type] = []
    var _doubleField: [Google_Protobuf_DoubleValue] = []
    var _floatField: [Google_Protobuf_FloatValue] = []
    var _int64Field: [Google_Protobuf_Int64Value] = []
    var _uint64Field: [Google_Protobuf_UInt64Value] = []
    var _int32Field: [Google_Protobuf_Int32Value] = []
    var _uint32Field: [Google_Protobuf_UInt32Value] = []
    var _boolField: [Google_Protobuf_BoolValue] = []
    var _stringField: [Google_Protobuf_StringValue] = []
    var _bytesField: [Google_Protobuf_BytesValue] = []

    init() {}

    init(copying source: _StorageClass) {
      _anyField = source._anyField
      _apiField = source._apiField
      _durationField = source._durationField
      _emptyField = source._emptyField
      _fieldMaskField = source._fieldMaskField
      _sourceContextField = source._sourceContextField
      _structField = source._structField
      _timestampField = source._timestampField
      _typeField = source._typeField
      _doubleField = source._doubleField
      _floatField = source._floatField
      _int64Field = source._int64Field
      _uint64Field = source._uint64Field
      _int32Field = source._int32Field
      _uint32Field = source._uint32Field
      _boolField = source._boolField
      _stringField = source._stringField
      _bytesField = source._bytesField
    }
  }

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

  func _protobuf_generated_isEqualTo(other: ProtobufUnittest_RepeatedWellKnownTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
        if _storage._anyField != other_storage._anyField {return false}
        if _storage._apiField != other_storage._apiField {return false}
        if _storage._durationField != other_storage._durationField {return false}
        if _storage._emptyField != other_storage._emptyField {return false}
        if _storage._fieldMaskField != other_storage._fieldMaskField {return false}
        if _storage._sourceContextField != other_storage._sourceContextField {return false}
        if _storage._structField != other_storage._structField {return false}
        if _storage._timestampField != other_storage._timestampField {return false}
        if _storage._typeField != other_storage._typeField {return false}
        if _storage._doubleField != other_storage._doubleField {return false}
        if _storage._floatField != other_storage._floatField {return false}
        if _storage._int64Field != other_storage._int64Field {return false}
        if _storage._uint64Field != other_storage._uint64Field {return false}
        if _storage._int32Field != other_storage._int32Field {return false}
        if _storage._uint32Field != other_storage._uint32Field {return false}
        if _storage._boolField != other_storage._boolField {return false}
        if _storage._stringField != other_storage._stringField {return false}
        if _storage._bytesField != other_storage._bytesField {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension ProtobufUnittest_OneofWellKnownTypes: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "any_field"),
    2: .standard(proto: "api_field"),
    3: .standard(proto: "duration_field"),
    4: .standard(proto: "empty_field"),
    5: .standard(proto: "field_mask_field"),
    6: .standard(proto: "source_context_field"),
    7: .standard(proto: "struct_field"),
    8: .standard(proto: "timestamp_field"),
    9: .standard(proto: "type_field"),
    10: .standard(proto: "double_field"),
    11: .standard(proto: "float_field"),
    12: .standard(proto: "int64_field"),
    13: .standard(proto: "uint64_field"),
    14: .standard(proto: "int32_field"),
    15: .standard(proto: "uint32_field"),
    16: .standard(proto: "bool_field"),
    17: .standard(proto: "string_field"),
    18: .standard(proto: "bytes_field"),
  ]

  fileprivate class _StorageClass {
    var _oneofField: ProtobufUnittest_OneofWellKnownTypes.OneOf_OneofField?

    init() {}

    init(copying source: _StorageClass) {
      _oneofField = source._oneofField
    }
  }

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

  func _protobuf_generated_isEqualTo(other: ProtobufUnittest_OneofWellKnownTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
        if _storage._oneofField != other_storage._oneofField {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension ProtobufUnittest_OneofWellKnownTypes.OneOf_OneofField {
  fileprivate init?<T: SwiftProtobuf.Decoder>(byDecodingFrom decoder: inout T, fieldNumber: Int) throws {
    switch fieldNumber {
    case 1:
      var value: Google_Protobuf_Any?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .anyField(value)
        return
      }
    case 2:
      var value: Google_Protobuf_Api?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .apiField(value)
        return
      }
    case 3:
      var value: Google_Protobuf_Duration?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .durationField(value)
        return
      }
    case 4:
      var value: Google_Protobuf_Empty?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .emptyField(value)
        return
      }
    case 5:
      var value: Google_Protobuf_FieldMask?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .fieldMaskField(value)
        return
      }
    case 6:
      var value: Google_Protobuf_SourceContext?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .sourceContextField(value)
        return
      }
    case 7:
      var value: Google_Protobuf_Struct?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .structField(value)
        return
      }
    case 8:
      var value: Google_Protobuf_Timestamp?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .timestampField(value)
        return
      }
    case 9:
      var value: Google_Protobuf_Type?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .typeField(value)
        return
      }
    case 10:
      var value: Google_Protobuf_DoubleValue?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .doubleField(value)
        return
      }
    case 11:
      var value: Google_Protobuf_FloatValue?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .floatField(value)
        return
      }
    case 12:
      var value: Google_Protobuf_Int64Value?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .int64Field(value)
        return
      }
    case 13:
      var value: Google_Protobuf_UInt64Value?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .uint64Field(value)
        return
      }
    case 14:
      var value: Google_Protobuf_Int32Value?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .int32Field(value)
        return
      }
    case 15:
      var value: Google_Protobuf_UInt32Value?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .uint32Field(value)
        return
      }
    case 16:
      var value: Google_Protobuf_BoolValue?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .boolField(value)
        return
      }
    case 17:
      var value: Google_Protobuf_StringValue?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .stringField(value)
        return
      }
    case 18:
      var value: Google_Protobuf_BytesValue?
      try decoder.decodeSingularMessageField(value: &value)
      if let value = value {
        self = .bytesField(value)
        return
      }
    default:
      break
    }
    return nil
  }

  fileprivate func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    switch self {
    case .anyField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    case .apiField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
    case .durationField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
    case .emptyField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
    case .fieldMaskField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
    case .sourceContextField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
    case .structField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
    case .timestampField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
    case .typeField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
    case .doubleField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
    case .floatField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
    case .int64Field(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
    case .uint64Field(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 13)
    case .int32Field(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 14)
    case .uint32Field(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 15)
    case .boolField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 16)
    case .stringField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 17)
    case .bytesField(let v):
      try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
    }
  }
}

extension ProtobufUnittest_MapWellKnownTypes: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "any_field"),
    2: .standard(proto: "api_field"),
    3: .standard(proto: "duration_field"),
    4: .standard(proto: "empty_field"),
    5: .standard(proto: "field_mask_field"),
    6: .standard(proto: "source_context_field"),
    7: .standard(proto: "struct_field"),
    8: .standard(proto: "timestamp_field"),
    9: .standard(proto: "type_field"),
    10: .standard(proto: "double_field"),
    11: .standard(proto: "float_field"),
    12: .standard(proto: "int64_field"),
    13: .standard(proto: "uint64_field"),
    14: .standard(proto: "int32_field"),
    15: .standard(proto: "uint32_field"),
    16: .standard(proto: "bool_field"),
    17: .standard(proto: "string_field"),
    18: .standard(proto: "bytes_field"),
  ]

  fileprivate class _StorageClass {
    var _anyField: Dictionary<Int32,Google_Protobuf_Any> = [:]
    var _apiField: Dictionary<Int32,Google_Protobuf_Api> = [:]
    var _durationField: Dictionary<Int32,Google_Protobuf_Duration> = [:]
    var _emptyField: Dictionary<Int32,Google_Protobuf_Empty> = [:]
    var _fieldMaskField: Dictionary<Int32,Google_Protobuf_FieldMask> = [:]
    var _sourceContextField: Dictionary<Int32,Google_Protobuf_SourceContext> = [:]
    var _structField: Dictionary<Int32,Google_Protobuf_Struct> = [:]
    var _timestampField: Dictionary<Int32,Google_Protobuf_Timestamp> = [:]
    var _typeField: Dictionary<Int32,Google_Protobuf_Type> = [:]
    var _doubleField: Dictionary<Int32,Google_Protobuf_DoubleValue> = [:]
    var _floatField: Dictionary<Int32,Google_Protobuf_FloatValue> = [:]
    var _int64Field: Dictionary<Int32,Google_Protobuf_Int64Value> = [:]
    var _uint64Field: Dictionary<Int32,Google_Protobuf_UInt64Value> = [:]
    var _int32Field: Dictionary<Int32,Google_Protobuf_Int32Value> = [:]
    var _uint32Field: Dictionary<Int32,Google_Protobuf_UInt32Value> = [:]
    var _boolField: Dictionary<Int32,Google_Protobuf_BoolValue> = [:]
    var _stringField: Dictionary<Int32,Google_Protobuf_StringValue> = [:]
    var _bytesField: Dictionary<Int32,Google_Protobuf_BytesValue> = [:]

    init() {}

    init(copying source: _StorageClass) {
      _anyField = source._anyField
      _apiField = source._apiField
      _durationField = source._durationField
      _emptyField = source._emptyField
      _fieldMaskField = source._fieldMaskField
      _sourceContextField = source._sourceContextField
      _structField = source._structField
      _timestampField = source._timestampField
      _typeField = source._typeField
      _doubleField = source._doubleField
      _floatField = source._floatField
      _int64Field = source._int64Field
      _uint64Field = source._uint64Field
      _int32Field = source._int32Field
      _uint32Field = source._uint32Field
      _boolField = source._boolField
      _stringField = source._stringField
      _bytesField = source._bytesField
    }
  }

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

  func _protobuf_generated_isEqualTo(other: ProtobufUnittest_MapWellKnownTypes) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
        if _storage._anyField != other_storage._anyField {return false}
        if _storage._apiField != other_storage._apiField {return false}
        if _storage._durationField != other_storage._durationField {return false}
        if _storage._emptyField != other_storage._emptyField {return false}
        if _storage._fieldMaskField != other_storage._fieldMaskField {return false}
        if _storage._sourceContextField != other_storage._sourceContextField {return false}
        if _storage._structField != other_storage._structField {return false}
        if _storage._timestampField != other_storage._timestampField {return false}
        if _storage._typeField != other_storage._typeField {return false}
        if _storage._doubleField != other_storage._doubleField {return false}
        if _storage._floatField != other_storage._floatField {return false}
        if _storage._int64Field != other_storage._int64Field {return false}
        if _storage._uint64Field != other_storage._uint64Field {return false}
        if _storage._int32Field != other_storage._int32Field {return false}
        if _storage._uint32Field != other_storage._uint32Field {return false}
        if _storage._boolField != other_storage._boolField {return false}
        if _storage._stringField != other_storage._stringField {return false}
        if _storage._bytesField != other_storage._bytesField {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}
