//
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//

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

//
// Copyright 2014 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

/// iOS - since we use a modern proto-compiler, we must specify
/// the legacy proto format.

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 you 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
}

struct IOSProtos_DeviceName {
  // 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.

  /// @required
  var ephemeralPublic: Data {
    get {return _ephemeralPublic ?? Data()}
    set {_ephemeralPublic = newValue}
  }
  /// Returns true if `ephemeralPublic` has been explicitly set.
  var hasEphemeralPublic: Bool {return self._ephemeralPublic != nil}
  /// Clears the value of `ephemeralPublic`. Subsequent reads from it will return its default value.
  mutating func clearEphemeralPublic() {self._ephemeralPublic = nil}

  /// @required
  var syntheticIv: Data {
    get {return _syntheticIv ?? Data()}
    set {_syntheticIv = newValue}
  }
  /// Returns true if `syntheticIv` has been explicitly set.
  var hasSyntheticIv: Bool {return self._syntheticIv != nil}
  /// Clears the value of `syntheticIv`. Subsequent reads from it will return its default value.
  mutating func clearSyntheticIv() {self._syntheticIv = nil}

  /// @required
  var ciphertext: Data {
    get {return _ciphertext ?? Data()}
    set {_ciphertext = newValue}
  }
  /// Returns true if `ciphertext` has been explicitly set.
  var hasCiphertext: Bool {return self._ciphertext != nil}
  /// Clears the value of `ciphertext`. Subsequent reads from it will return its default value.
  mutating func clearCiphertext() {self._ciphertext = nil}

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _ephemeralPublic: Data? = nil
  fileprivate var _syntheticIv: Data? = nil
  fileprivate var _ciphertext: Data? = nil
}

#if swift(>=5.5) && canImport(_Concurrency)
extension IOSProtos_DeviceName: @unchecked Sendable {}
#endif  // swift(>=5.5) && canImport(_Concurrency)

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

fileprivate let _protobuf_package = "IOSProtos"

extension IOSProtos_DeviceName: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".DeviceName"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "ephemeralPublic"),
    2: .same(proto: "syntheticIv"),
    3: .same(proto: "ciphertext"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      // The use of inline closures is to circumvent an issue where the compiler
      // allocates stack space for every case branch when no optimizations are
      // enabled. https://github.com/apple/swift-protobuf/issues/1034
      switch fieldNumber {
      case 1: try { try decoder.decodeSingularBytesField(value: &self._ephemeralPublic) }()
      case 2: try { try decoder.decodeSingularBytesField(value: &self._syntheticIv) }()
      case 3: try { try decoder.decodeSingularBytesField(value: &self._ciphertext) }()
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    // The use of inline closures is to circumvent an issue where the compiler
    // allocates stack space for every if/case branch local when no optimizations
    // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
    // https://github.com/apple/swift-protobuf/issues/1182
    try { if let v = self._ephemeralPublic {
      try visitor.visitSingularBytesField(value: v, fieldNumber: 1)
    } }()
    try { if let v = self._syntheticIv {
      try visitor.visitSingularBytesField(value: v, fieldNumber: 2)
    } }()
    try { if let v = self._ciphertext {
      try visitor.visitSingularBytesField(value: v, fieldNumber: 3)
    } }()
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: IOSProtos_DeviceName, rhs: IOSProtos_DeviceName) -> Bool {
    if lhs._ephemeralPublic != rhs._ephemeralPublic {return false}
    if lhs._syntheticIv != rhs._syntheticIv {return false}
    if lhs._ciphertext != rhs._ciphertext {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}
