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

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

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
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 RegistrationProtos_RegistrationProvisionEnvelope: Sendable {
  // 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 publicKey: Data = Data()

  /// Encrypted RegistrationProvisionMessage
  var body: Data = Data()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct RegistrationProtos_RegistrationProvisionMessage: Sendable {
  // 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 e164: String = String()

  var aci: Data = Data()

  var accountEntropyPool: String = String()

  var pin: String = String()

  var platform: RegistrationProtos_RegistrationProvisionMessage.Platform = .android

  var backupTimestampMs: UInt64 = 0

  var tier: RegistrationProtos_RegistrationProvisionMessage.Tier {
    get {_tier ?? .free}
    set {_tier = newValue}
  }
  /// Returns true if `tier` has been explicitly set.
  var hasTier: Bool {self._tier != nil}
  /// Clears the value of `tier`. Subsequent reads from it will return its default value.
  mutating func clearTier() {self._tier = nil}

  var backupSizeBytes: UInt64 = 0

  var restoreMethodToken: String = String()

  var aciIdentityKeyPublic: Data = Data()

  var aciIdentityKeyPrivate: Data = Data()

  var pniIdentityKeyPublic: Data = Data()

  var pniIdentityKeyPrivate: Data = Data()

  var backupVersion: UInt64 = 0

  var lastBackupForwardSecrecyToken: Data = Data()

  var nextBackupSecretData: Data = Data()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  enum Platform: SwiftProtobuf.Enum, Swift.CaseIterable {
    typealias RawValue = Int
    case android // = 0
    case ios // = 1
    case UNRECOGNIZED(Int)

    init() {
      self = .android
    }

    init?(rawValue: Int) {
      switch rawValue {
      case 0: self = .android
      case 1: self = .ios
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    var rawValue: Int {
      switch self {
      case .android: return 0
      case .ios: return 1
      case .UNRECOGNIZED(let i): return i
      }
    }

    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static let allCases: [RegistrationProtos_RegistrationProvisionMessage.Platform] = [
      .android,
      .ios,
    ]

  }

  enum Tier: SwiftProtobuf.Enum, Swift.CaseIterable {
    typealias RawValue = Int
    case free // = 0
    case paid // = 1
    case UNRECOGNIZED(Int)

    init() {
      self = .free
    }

    init?(rawValue: Int) {
      switch rawValue {
      case 0: self = .free
      case 1: self = .paid
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    var rawValue: Int {
      switch self {
      case .free: return 0
      case .paid: return 1
      case .UNRECOGNIZED(let i): return i
      }
    }

    // The compiler won't synthesize support with the UNRECOGNIZED case.
    static let allCases: [RegistrationProtos_RegistrationProvisionMessage.Tier] = [
      .free,
      .paid,
    ]

  }

  init() {}

  fileprivate var _tier: RegistrationProtos_RegistrationProvisionMessage.Tier? = nil
}

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

fileprivate let _protobuf_package = "RegistrationProtos"

extension RegistrationProtos_RegistrationProvisionEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".RegistrationProvisionEnvelope"
  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}publicKey\0\u{1}body\0")

  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.publicKey) }()
      case 2: try { try decoder.decodeSingularBytesField(value: &self.body) }()
      default: break
      }
    }
  }

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

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

extension RegistrationProtos_RegistrationProvisionMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = _protobuf_package + ".RegistrationProvisionMessage"
  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}e164\0\u{1}aci\0\u{1}accountEntropyPool\0\u{1}pin\0\u{1}platform\0\u{1}backupTimestampMs\0\u{1}tier\0\u{1}backupSizeBytes\0\u{1}restoreMethodToken\0\u{1}aciIdentityKeyPublic\0\u{1}aciIdentityKeyPrivate\0\u{1}pniIdentityKeyPublic\0\u{1}pniIdentityKeyPrivate\0\u{1}backupVersion\0\u{1}lastBackupForwardSecrecyToken\0\u{1}nextBackupSecretData\0")

  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.decodeSingularStringField(value: &self.e164) }()
      case 2: try { try decoder.decodeSingularBytesField(value: &self.aci) }()
      case 3: try { try decoder.decodeSingularStringField(value: &self.accountEntropyPool) }()
      case 4: try { try decoder.decodeSingularStringField(value: &self.pin) }()
      case 5: try { try decoder.decodeSingularEnumField(value: &self.platform) }()
      case 6: try { try decoder.decodeSingularUInt64Field(value: &self.backupTimestampMs) }()
      case 7: try { try decoder.decodeSingularEnumField(value: &self._tier) }()
      case 8: try { try decoder.decodeSingularUInt64Field(value: &self.backupSizeBytes) }()
      case 9: try { try decoder.decodeSingularStringField(value: &self.restoreMethodToken) }()
      case 10: try { try decoder.decodeSingularBytesField(value: &self.aciIdentityKeyPublic) }()
      case 11: try { try decoder.decodeSingularBytesField(value: &self.aciIdentityKeyPrivate) }()
      case 12: try { try decoder.decodeSingularBytesField(value: &self.pniIdentityKeyPublic) }()
      case 13: try { try decoder.decodeSingularBytesField(value: &self.pniIdentityKeyPrivate) }()
      case 14: try { try decoder.decodeSingularUInt64Field(value: &self.backupVersion) }()
      case 15: try { try decoder.decodeSingularBytesField(value: &self.lastBackupForwardSecrecyToken) }()
      case 16: try { try decoder.decodeSingularBytesField(value: &self.nextBackupSecretData) }()
      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
    if !self.e164.isEmpty {
      try visitor.visitSingularStringField(value: self.e164, fieldNumber: 1)
    }
    if !self.aci.isEmpty {
      try visitor.visitSingularBytesField(value: self.aci, fieldNumber: 2)
    }
    if !self.accountEntropyPool.isEmpty {
      try visitor.visitSingularStringField(value: self.accountEntropyPool, fieldNumber: 3)
    }
    if !self.pin.isEmpty {
      try visitor.visitSingularStringField(value: self.pin, fieldNumber: 4)
    }
    if self.platform != .android {
      try visitor.visitSingularEnumField(value: self.platform, fieldNumber: 5)
    }
    if self.backupTimestampMs != 0 {
      try visitor.visitSingularUInt64Field(value: self.backupTimestampMs, fieldNumber: 6)
    }
    try { if let v = self._tier {
      try visitor.visitSingularEnumField(value: v, fieldNumber: 7)
    } }()
    if self.backupSizeBytes != 0 {
      try visitor.visitSingularUInt64Field(value: self.backupSizeBytes, fieldNumber: 8)
    }
    if !self.restoreMethodToken.isEmpty {
      try visitor.visitSingularStringField(value: self.restoreMethodToken, fieldNumber: 9)
    }
    if !self.aciIdentityKeyPublic.isEmpty {
      try visitor.visitSingularBytesField(value: self.aciIdentityKeyPublic, fieldNumber: 10)
    }
    if !self.aciIdentityKeyPrivate.isEmpty {
      try visitor.visitSingularBytesField(value: self.aciIdentityKeyPrivate, fieldNumber: 11)
    }
    if !self.pniIdentityKeyPublic.isEmpty {
      try visitor.visitSingularBytesField(value: self.pniIdentityKeyPublic, fieldNumber: 12)
    }
    if !self.pniIdentityKeyPrivate.isEmpty {
      try visitor.visitSingularBytesField(value: self.pniIdentityKeyPrivate, fieldNumber: 13)
    }
    if self.backupVersion != 0 {
      try visitor.visitSingularUInt64Field(value: self.backupVersion, fieldNumber: 14)
    }
    if !self.lastBackupForwardSecrecyToken.isEmpty {
      try visitor.visitSingularBytesField(value: self.lastBackupForwardSecrecyToken, fieldNumber: 15)
    }
    if !self.nextBackupSecretData.isEmpty {
      try visitor.visitSingularBytesField(value: self.nextBackupSecretData, fieldNumber: 16)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: RegistrationProtos_RegistrationProvisionMessage, rhs: RegistrationProtos_RegistrationProvisionMessage) -> Bool {
    if lhs.e164 != rhs.e164 {return false}
    if lhs.aci != rhs.aci {return false}
    if lhs.accountEntropyPool != rhs.accountEntropyPool {return false}
    if lhs.pin != rhs.pin {return false}
    if lhs.platform != rhs.platform {return false}
    if lhs.backupTimestampMs != rhs.backupTimestampMs {return false}
    if lhs._tier != rhs._tier {return false}
    if lhs.backupSizeBytes != rhs.backupSizeBytes {return false}
    if lhs.restoreMethodToken != rhs.restoreMethodToken {return false}
    if lhs.aciIdentityKeyPublic != rhs.aciIdentityKeyPublic {return false}
    if lhs.aciIdentityKeyPrivate != rhs.aciIdentityKeyPrivate {return false}
    if lhs.pniIdentityKeyPublic != rhs.pniIdentityKeyPublic {return false}
    if lhs.pniIdentityKeyPrivate != rhs.pniIdentityKeyPrivate {return false}
    if lhs.backupVersion != rhs.backupVersion {return false}
    if lhs.lastBackupForwardSecrecyToken != rhs.lastBackupForwardSecrecyToken {return false}
    if lhs.nextBackupSecretData != rhs.nextBackupSecretData {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension RegistrationProtos_RegistrationProvisionMessage.Platform: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0ANDROID\0\u{1}IOS\0")
}

extension RegistrationProtos_RegistrationProvisionMessage.Tier: SwiftProtobuf._ProtoNameProviding {
  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0FREE\0\u{1}PAID\0")
}
