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

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 HisOperation: SwiftProtobuf.Enum {
  typealias RawValue = Int

  /// get index table
  case itSync // = 0

  /// start sync
  case startSync // = 1

  /// stop sync
  case stopSync // = 2

  init() {
    self = .itSync
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .itSync
    case 1: self = .startSync
    case 2: self = .stopSync
    default: return nil
    }
  }

  var rawValue: Int {
    switch self {
    case .itSync: return 0
    case .startSync: return 1
    case .stopSync: return 2
    }
  }

}

#if swift(>=4.2)

extension HisOperation: CaseIterable {
  // Support synthesized by the compiler.
}

#endif  // swift(>=4.2)

enum HisDataType: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case healthData // = 0
  case gnssData // = 1
  case ecgData // = 2
  case ppgData // = 3
  case rriData // = 4
  case medicData // = 5
  case spo2Data // = 6
  case swimData // = 7

  init() {
    self = .healthData
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .healthData
    case 1: self = .gnssData
    case 2: self = .ecgData
    case 3: self = .ppgData
    case 4: self = .rriData
    case 5: self = .medicData
    case 6: self = .spo2Data
    case 7: self = .swimData
    default: return nil
    }
  }

  var rawValue: Int {
    switch self {
    case .healthData: return 0
    case .gnssData: return 1
    case .ecgData: return 2
    case .ppgData: return 3
    case .rriData: return 4
    case .medicData: return 5
    case .spo2Data: return 6
    case .swimData: return 7
    }
  }

}

#if swift(>=4.2)

extension HisDataType: CaseIterable {
  // Support synthesized by the compiler.
}

#endif  // swift(>=4.2)

enum HisDataStatus: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case statusOk // = 0
  case statusInnerError // = 1
  case statusNvError // = 2
  case statusCrcError // = 3
  case statusTypeError // = 4
  case statusNotSupported // = 5

  init() {
    self = .statusOk
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .statusOk
    case 1: self = .statusInnerError
    case 2: self = .statusNvError
    case 3: self = .statusCrcError
    case 4: self = .statusTypeError
    case 5: self = .statusNotSupported
    default: return nil
    }
  }

  var rawValue: Int {
    switch self {
    case .statusOk: return 0
    case .statusInnerError: return 1
    case .statusNvError: return 2
    case .statusCrcError: return 3
    case .statusTypeError: return 4
    case .statusNotSupported: return 5
    }
  }

}

#if swift(>=4.2)

extension HisDataStatus: CaseIterable {
  // Support synthesized by the compiler.
}

#endif  // swift(>=4.2)

struct HisBlock {
  // 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 startSeq: UInt32 {
    get {return _startSeq ?? 0}
    set {_startSeq = newValue}
  }
  /// Returns true if `startSeq` has been explicitly set.
  var hasStartSeq: Bool {return self._startSeq != nil}
  /// Clears the value of `startSeq`. Subsequent reads from it will return its default value.
  mutating func clearStartSeq() {self._startSeq = nil}

  var endSeq: UInt32 {
    get {return _endSeq ?? 0}
    set {_endSeq = newValue}
  }
  /// Returns true if `endSeq` has been explicitly set.
  var hasEndSeq: Bool {return self._endSeq != nil}
  /// Clears the value of `endSeq`. Subsequent reads from it will return its default value.
  mutating func clearEndSeq() {self._endSeq = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _startSeq: UInt32? = nil
  fileprivate var _endSeq: UInt32? = nil
}

struct HisITSync {
  // 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 type: HisDataType {
    get {return _type ?? .healthData}
    set {_type = newValue}
  }
  /// Returns true if `type` has been explicitly set.
  var hasType: Bool {return self._type != nil}
  /// Clears the value of `type`. Subsequent reads from it will return its default value.
  mutating func clearType() {self._type = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _type: HisDataType? = nil
}

struct HisStartSync {
  // 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 type: HisDataType {
    get {return _type ?? .healthData}
    set {_type = newValue}
  }
  /// Returns true if `type` has been explicitly set.
  var hasType: Bool {return self._type != nil}
  /// Clears the value of `type`. Subsequent reads from it will return its default value.
  mutating func clearType() {self._type = nil}

  var block: [HisBlock] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _type: HisDataType? = nil
}

struct HisStopSync {
  // 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 type: HisDataType {
    get {return _type ?? .healthData}
    set {_type = newValue}
  }
  /// Returns true if `type` has been explicitly set.
  var hasType: Bool {return self._type != nil}
  /// Clears the value of `type`. Subsequent reads from it will return its default value.
  mutating func clearType() {self._type = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _type: HisDataType? = nil
}

struct HisSubscriber {
  // 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 operation: HisOperation {
    get {return _storage._operation ?? .itSync}
    set {_uniqueStorage()._operation = newValue}
  }
  /// Returns true if `operation` has been explicitly set.
  var hasOperation: Bool {return _storage._operation != nil}
  /// Clears the value of `operation`. Subsequent reads from it will return its default value.
  mutating func clearOperation() {_uniqueStorage()._operation = nil}

  var data: OneOf_Data? {
    get {return _storage._data}
    set {_uniqueStorage()._data = newValue}
  }

  var itSync: HisITSync {
    get {
      if case .itSync(let v)? = _storage._data {return v}
      return HisITSync()
    }
    set {_uniqueStorage()._data = .itSync(newValue)}
  }

  var startSync: HisStartSync {
    get {
      if case .startSync(let v)? = _storage._data {return v}
      return HisStartSync()
    }
    set {_uniqueStorage()._data = .startSync(newValue)}
  }

  var stopSync: HisStopSync {
    get {
      if case .stopSync(let v)? = _storage._data {return v}
      return HisStopSync()
    }
    set {_uniqueStorage()._data = .stopSync(newValue)}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum OneOf_Data: Equatable {
    case itSync(HisITSync)
    case startSync(HisStartSync)
    case stopSync(HisStopSync)

  #if !swift(>=4.1)
    static func ==(lhs: HisSubscriber.OneOf_Data, rhs: HisSubscriber.OneOf_Data) -> Bool {
      switch (lhs, rhs) {
      case (.itSync(let l), .itSync(let r)): return l == r
      case (.startSync(let l), .startSync(let r)): return l == r
      case (.stopSync(let l), .stopSync(let r)): return l == r
      default: return false
      }
    }
  #endif
  }

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

struct HisIndex {
  // 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 time: RtTime {
    get {return _storage._time ?? RtTime()}
    set {_uniqueStorage()._time = newValue}
  }
  /// Returns true if `time` has been explicitly set.
  var hasTime: Bool {return _storage._time != nil}
  /// Clears the value of `time`. Subsequent reads from it will return its default value.
  mutating func clearTime() {_uniqueStorage()._time = nil}

  var startSeq: UInt32 {
    get {return _storage._startSeq ?? 0}
    set {_uniqueStorage()._startSeq = newValue}
  }
  /// Returns true if `startSeq` has been explicitly set.
  var hasStartSeq: Bool {return _storage._startSeq != nil}
  /// Clears the value of `startSeq`. Subsequent reads from it will return its default value.
  mutating func clearStartSeq() {_uniqueStorage()._startSeq = nil}

  var endSeq: UInt32 {
    get {return _storage._endSeq ?? 0}
    set {_uniqueStorage()._endSeq = newValue}
  }
  /// Returns true if `endSeq` has been explicitly set.
  var hasEndSeq: Bool {return _storage._endSeq != nil}
  /// Clears the value of `endSeq`. Subsequent reads from it will return its default value.
  mutating func clearEndSeq() {_uniqueStorage()._endSeq = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

struct HisIndexTable {
  // 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 index: [HisIndex] = []

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct HisData {
  // 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 seq: UInt32 {
    get {return _storage._seq ?? 0}
    set {_uniqueStorage()._seq = newValue}
  }
  /// Returns true if `seq` has been explicitly set.
  var hasSeq: Bool {return _storage._seq != nil}
  /// Clears the value of `seq`. Subsequent reads from it will return its default value.
  mutating func clearSeq() {_uniqueStorage()._seq = nil}

  var data: OneOf_Data? {
    get {return _storage._data}
    set {_uniqueStorage()._data = newValue}
  }

  var status: HisDataStatus {
    get {
      if case .status(let v)? = _storage._data {return v}
      return .statusOk
    }
    set {_uniqueStorage()._data = .status(newValue)}
  }

  var health: HisDataHealth {
    get {
      if case .health(let v)? = _storage._data {return v}
      return HisDataHealth()
    }
    set {_uniqueStorage()._data = .health(newValue)}
  }

  var gnss: HisDataGNSS {
    get {
      if case .gnss(let v)? = _storage._data {return v}
      return HisDataGNSS()
    }
    set {_uniqueStorage()._data = .gnss(newValue)}
  }

  var ecg: HisDataECG {
    get {
      if case .ecg(let v)? = _storage._data {return v}
      return HisDataECG()
    }
    set {_uniqueStorage()._data = .ecg(newValue)}
  }

  var ppg: HisDataPPG {
    get {
      if case .ppg(let v)? = _storage._data {return v}
      return HisDataPPG()
    }
    set {_uniqueStorage()._data = .ppg(newValue)}
  }

  var rri: HisDataRRI {
    get {
      if case .rri(let v)? = _storage._data {return v}
      return HisDataRRI()
    }
    set {_uniqueStorage()._data = .rri(newValue)}
  }

  var medic: HisDataMedic {
    get {
      if case .medic(let v)? = _storage._data {return v}
      return HisDataMedic()
    }
    set {_uniqueStorage()._data = .medic(newValue)}
  }

  var spo2: HisDataSpo2 {
    get {
      if case .spo2(let v)? = _storage._data {return v}
      return HisDataSpo2()
    }
    set {_uniqueStorage()._data = .spo2(newValue)}
  }

  var swim: HisDataSwim {
    get {
      if case .swim(let v)? = _storage._data {return v}
      return HisDataSwim()
    }
    set {_uniqueStorage()._data = .swim(newValue)}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum OneOf_Data: Equatable {
    case status(HisDataStatus)
    case health(HisDataHealth)
    case gnss(HisDataGNSS)
    case ecg(HisDataECG)
    case ppg(HisDataPPG)
    case rri(HisDataRRI)
    case medic(HisDataMedic)
    case spo2(HisDataSpo2)
    case swim(HisDataSwim)

  #if !swift(>=4.1)
    static func ==(lhs: HisData.OneOf_Data, rhs: HisData.OneOf_Data) -> Bool {
      switch (lhs, rhs) {
      case (.status(let l), .status(let r)): return l == r
      case (.health(let l), .health(let r)): return l == r
      case (.gnss(let l), .gnss(let r)): return l == r
      case (.ecg(let l), .ecg(let r)): return l == r
      case (.ppg(let l), .ppg(let r)): return l == r
      case (.rri(let l), .rri(let r)): return l == r
      case (.medic(let l), .medic(let r)): return l == r
      case (.spo2(let l), .spo2(let r)): return l == r
      case (.swim(let l), .swim(let r)): return l == r
      default: return false
      }
    }
  #endif
  }

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

struct HisConfirm {
  // 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 operation: HisOperation {
    get {return _operation ?? .itSync}
    set {_operation = newValue}
  }
  /// Returns true if `operation` has been explicitly set.
  var hasOperation: Bool {return self._operation != nil}
  /// Clears the value of `operation`. Subsequent reads from it will return its default value.
  mutating func clearOperation() {self._operation = nil}

  var ret: Bool {
    get {return _ret ?? false}
    set {_ret = newValue}
  }
  /// Returns true if `ret` has been explicitly set.
  var hasRet: Bool {return self._ret != nil}
  /// Clears the value of `ret`. Subsequent reads from it will return its default value.
  mutating func clearRet() {self._ret = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _operation: HisOperation? = nil
  fileprivate var _ret: Bool? = nil
}

struct HisNotification {
  // 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 type: HisDataType {
    get {return _storage._type ?? .healthData}
    set {_uniqueStorage()._type = newValue}
  }
  /// Returns true if `type` has been explicitly set.
  var hasType: Bool {return _storage._type != nil}
  /// Clears the value of `type`. Subsequent reads from it will return its default value.
  mutating func clearType() {_uniqueStorage()._type = nil}

  var data: OneOf_Data? {
    get {return _storage._data}
    set {_uniqueStorage()._data = newValue}
  }

  var confirm: HisConfirm {
    get {
      if case .confirm(let v)? = _storage._data {return v}
      return HisConfirm()
    }
    set {_uniqueStorage()._data = .confirm(newValue)}
  }

  var indexTable: HisIndexTable {
    get {
      if case .indexTable(let v)? = _storage._data {return v}
      return HisIndexTable()
    }
    set {_uniqueStorage()._data = .indexTable(newValue)}
  }

  var hisData: HisData {
    get {
      if case .hisData(let v)? = _storage._data {return v}
      return HisData()
    }
    set {_uniqueStorage()._data = .hisData(newValue)}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum OneOf_Data: Equatable {
    case confirm(HisConfirm)
    case indexTable(HisIndexTable)
    case hisData(HisData)

  #if !swift(>=4.1)
    static func ==(lhs: HisNotification.OneOf_Data, rhs: HisNotification.OneOf_Data) -> Bool {
      switch (lhs, rhs) {
      case (.confirm(let l), .confirm(let r)): return l == r
      case (.indexTable(let l), .indexTable(let r)): return l == r
      case (.hisData(let l), .hisData(let r)): return l == r
      default: return false
      }
    }
  #endif
  }

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

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

extension HisOperation: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "IT_SYNC"),
    1: .same(proto: "START_SYNC"),
    2: .same(proto: "STOP_SYNC"),
  ]
}

extension HisDataType: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "HEALTH_DATA"),
    1: .same(proto: "GNSS_DATA"),
    2: .same(proto: "ECG_DATA"),
    3: .same(proto: "PPG_DATA"),
    4: .same(proto: "RRI_DATA"),
    5: .same(proto: "MEDIC_DATA"),
    6: .same(proto: "SPO2_DATA"),
    7: .same(proto: "SWIM_DATA"),
  ]
}

extension HisDataStatus: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    0: .same(proto: "STATUS_OK"),
    1: .same(proto: "STATUS_INNER_ERROR"),
    2: .same(proto: "STATUS_NV_ERROR"),
    3: .same(proto: "STATUS_CRC_ERROR"),
    4: .same(proto: "STATUS_TYPE_ERROR"),
    5: .same(proto: "STATUS_NOT_SUPPORTED"),
  ]
}

extension HisBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisBlock"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "start_seq"),
    2: .standard(proto: "end_seq"),
  ]

  public var isInitialized: Bool {
    if self._startSeq == nil {return false}
    if self._endSeq == nil {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._startSeq {
      try visitor.visitSingularFixed32Field(value: v, fieldNumber: 1)
    }
    if let v = self._endSeq {
      try visitor.visitSingularFixed32Field(value: v, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisBlock, rhs: HisBlock) -> Bool {
    if lhs._startSeq != rhs._startSeq {return false}
    if lhs._endSeq != rhs._endSeq {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

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

  public var isInitialized: Bool {
    if self._type == nil {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._type {
      try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisITSync, rhs: HisITSync) -> Bool {
    if lhs._type != rhs._type {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisStartSync: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisStartSync"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "type"),
    2: .same(proto: "block"),
  ]

  public var isInitialized: Bool {
    if self._type == nil {return false}
    if !SwiftProtobuf.Internal.areAllInitialized(self.block) {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._type {
      try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
    }
    if !self.block.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.block, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisStartSync, rhs: HisStartSync) -> Bool {
    if lhs._type != rhs._type {return false}
    if lhs.block != rhs.block {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

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

  public var isInitialized: Bool {
    if self._type == nil {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._type {
      try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisStopSync, rhs: HisStopSync) -> Bool {
    if lhs._type != rhs._type {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisSubscriber: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisSubscriber"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "operation"),
    2: .standard(proto: "it_sync"),
    3: .standard(proto: "start_sync"),
    4: .standard(proto: "stop_sync"),
  ]

  fileprivate class _StorageClass {
    var _operation: HisOperation? = nil
    var _data: HisSubscriber.OneOf_Data?

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _operation = source._operation
      _data = source._data
    }
  }

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

  public var isInitialized: Bool {
    return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if _storage._operation == nil {return false}
      switch _storage._data {
      case .itSync(let v)?: if !v.isInitialized {return false}
      case .startSync(let v)?: if !v.isInitialized {return false}
      case .stopSync(let v)?: if !v.isInitialized {return false}
      default: break
      }
      return true
    }
  }

  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.decodeSingularEnumField(value: &_storage._operation)
        case 2:
          var v: HisITSync?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .itSync(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .itSync(v)}
        case 3:
          var v: HisStartSync?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .startSync(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .startSync(v)}
        case 4:
          var v: HisStopSync?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .stopSync(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .stopSync(v)}
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if let v = _storage._operation {
        try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
      }
      switch _storage._data {
      case .itSync(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      case .startSync(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      case .stopSync(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      case nil: break
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisSubscriber, rhs: HisSubscriber) -> Bool {
    if lhs._storage !== rhs._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let rhs_storage = _args.1
        if _storage._operation != rhs_storage._operation {return false}
        if _storage._data != rhs_storage._data {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisIndex: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisIndex"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "time"),
    2: .standard(proto: "start_seq"),
    3: .standard(proto: "end_seq"),
  ]

  fileprivate class _StorageClass {
    var _time: RtTime? = nil
    var _startSeq: UInt32? = nil
    var _endSeq: UInt32? = nil

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _time = source._time
      _startSeq = source._startSeq
      _endSeq = source._endSeq
    }
  }

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

  public var isInitialized: Bool {
    return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if _storage._time == nil {return false}
      if _storage._startSeq == nil {return false}
      if _storage._endSeq == nil {return false}
      if let v = _storage._time, !v.isInitialized {return false}
      return true
    }
  }

  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._time)
        case 2: try decoder.decodeSingularFixed32Field(value: &_storage._startSeq)
        case 3: try decoder.decodeSingularFixed32Field(value: &_storage._endSeq)
        default: break
        }
      }
    }
  }

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

  static func ==(lhs: HisIndex, rhs: HisIndex) -> Bool {
    if lhs._storage !== rhs._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let rhs_storage = _args.1
        if _storage._time != rhs_storage._time {return false}
        if _storage._startSeq != rhs_storage._startSeq {return false}
        if _storage._endSeq != rhs_storage._endSeq {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

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

  public var isInitialized: Bool {
    if !SwiftProtobuf.Internal.areAllInitialized(self.index) {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.index.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.index, fieldNumber: 1)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisIndexTable, rhs: HisIndexTable) -> Bool {
    if lhs.index != rhs.index {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisData"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "seq"),
    2: .same(proto: "status"),
    3: .same(proto: "health"),
    4: .same(proto: "gnss"),
    5: .same(proto: "ecg"),
    6: .same(proto: "ppg"),
    7: .same(proto: "rri"),
    8: .same(proto: "medic"),
    9: .same(proto: "spo2"),
    10: .same(proto: "swim"),
  ]

  fileprivate class _StorageClass {
    var _seq: UInt32? = nil
    var _data: HisData.OneOf_Data?

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _seq = source._seq
      _data = source._data
    }
  }

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

  public var isInitialized: Bool {
    return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if _storage._seq == nil {return false}
      switch _storage._data {
      case .health(let v)?: if !v.isInitialized {return false}
      case .gnss(let v)?: if !v.isInitialized {return false}
      case .ecg(let v)?: if !v.isInitialized {return false}
      case .ppg(let v)?: if !v.isInitialized {return false}
      case .rri(let v)?: if !v.isInitialized {return false}
      case .medic(let v)?: if !v.isInitialized {return false}
      case .spo2(let v)?: if !v.isInitialized {return false}
      case .swim(let v)?: if !v.isInitialized {return false}
      default: break
      }
      return true
    }
  }

  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.decodeSingularFixed32Field(value: &_storage._seq)
        case 2:
          if _storage._data != nil {try decoder.handleConflictingOneOf()}
          var v: HisDataStatus?
          try decoder.decodeSingularEnumField(value: &v)
          if let v = v {_storage._data = .status(v)}
        case 3:
          var v: HisDataHealth?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .health(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .health(v)}
        case 4:
          var v: HisDataGNSS?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .gnss(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .gnss(v)}
        case 5:
          var v: HisDataECG?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .ecg(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .ecg(v)}
        case 6:
          var v: HisDataPPG?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .ppg(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .ppg(v)}
        case 7:
          var v: HisDataRRI?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .rri(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .rri(v)}
        case 8:
          var v: HisDataMedic?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .medic(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .medic(v)}
        case 9:
          var v: HisDataSpo2?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .spo2(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .spo2(v)}
        case 10:
          var v: HisDataSwim?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .swim(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .swim(v)}
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if let v = _storage._seq {
        try visitor.visitSingularFixed32Field(value: v, fieldNumber: 1)
      }
      switch _storage._data {
      case .status(let v)?:
        try visitor.visitSingularEnumField(value: v, fieldNumber: 2)
      case .health(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      case .gnss(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      case .ecg(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
      case .ppg(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
      case .rri(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
      case .medic(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
      case .spo2(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
      case .swim(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
      case nil: break
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisData, rhs: HisData) -> Bool {
    if lhs._storage !== rhs._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let rhs_storage = _args.1
        if _storage._seq != rhs_storage._seq {return false}
        if _storage._data != rhs_storage._data {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisConfirm: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisConfirm"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "operation"),
    2: .same(proto: "ret"),
  ]

  public var isInitialized: Bool {
    if self._operation == nil {return false}
    if self._ret == nil {return false}
    return true
  }

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

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if let v = self._operation {
      try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
    }
    if let v = self._ret {
      try visitor.visitSingularBoolField(value: v, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisConfirm, rhs: HisConfirm) -> Bool {
    if lhs._operation != rhs._operation {return false}
    if lhs._ret != rhs._ret {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension HisNotification: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "HisNotification"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "type"),
    2: .same(proto: "confirm"),
    3: .standard(proto: "index_table"),
    4: .standard(proto: "his_data"),
  ]

  fileprivate class _StorageClass {
    var _type: HisDataType? = nil
    var _data: HisNotification.OneOf_Data?

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _type = source._type
      _data = source._data
    }
  }

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

  public var isInitialized: Bool {
    return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if _storage._type == nil {return false}
      switch _storage._data {
      case .confirm(let v)?: if !v.isInitialized {return false}
      case .indexTable(let v)?: if !v.isInitialized {return false}
      case .hisData(let v)?: if !v.isInitialized {return false}
      default: break
      }
      return true
    }
  }

  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.decodeSingularEnumField(value: &_storage._type)
        case 2:
          var v: HisConfirm?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .confirm(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .confirm(v)}
        case 3:
          var v: HisIndexTable?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .indexTable(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .indexTable(v)}
        case 4:
          var v: HisData?
          if let current = _storage._data {
            try decoder.handleConflictingOneOf()
            if case .hisData(let m) = current {v = m}
          }
          try decoder.decodeSingularMessageField(value: &v)
          if let v = v {_storage._data = .hisData(v)}
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if let v = _storage._type {
        try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
      }
      switch _storage._data {
      case .confirm(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      case .indexTable(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      case .hisData(let v)?:
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      case nil: break
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: HisNotification, rhs: HisNotification) -> Bool {
    if lhs._storage !== rhs._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
        let _storage = _args.0
        let rhs_storage = _args.1
        if _storage._type != rhs_storage._type {return false}
        if _storage._data != rhs_storage._data {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
