firebase_ml_log_sdk.pb.swift 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: firebase_ml_log_sdk.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright 2021 Google LLC
  11. //
  12. // Licensed under the Apache License, Version 2.0 (the "License");
  13. // you may not use this file except in compliance with the License.
  14. // You may obtain a copy of the License at
  15. //
  16. // http://www.apache.org/licenses/LICENSE-2.0
  17. //
  18. // Unless required by applicable law or agreed to in writing, software
  19. // distributed under the License is distributed on an "AS IS" BASIS,
  20. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. // See the License for the specific language governing permissions and
  22. // limitations under the License.
  23. import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. enum EventName: SwiftProtobuf.Enum, Swift.CaseIterable {
  34. typealias RawValue = Int
  35. case unknownEvent // = 0
  36. case modelDownload // = 100
  37. case modelUpdate // = 101
  38. case remoteModelDeleteOnDevice // = 252
  39. case UNRECOGNIZED(Int)
  40. init() {
  41. self = .unknownEvent
  42. }
  43. init?(rawValue: Int) {
  44. switch rawValue {
  45. case 0: self = .unknownEvent
  46. case 100: self = .modelDownload
  47. case 101: self = .modelUpdate
  48. case 252: self = .remoteModelDeleteOnDevice
  49. default: self = .UNRECOGNIZED(rawValue)
  50. }
  51. }
  52. var rawValue: Int {
  53. switch self {
  54. case .unknownEvent: return 0
  55. case .modelDownload: return 100
  56. case .modelUpdate: return 101
  57. case .remoteModelDeleteOnDevice: return 252
  58. case .UNRECOGNIZED(let i): return i
  59. }
  60. }
  61. // The compiler won't synthesize support with the UNRECOGNIZED case.
  62. static let allCases: [EventName] = [
  63. .unknownEvent,
  64. .modelDownload,
  65. .modelUpdate,
  66. .remoteModelDeleteOnDevice,
  67. ]
  68. }
  69. /// A list of error codes for various components of the system. For model downloading, the
  70. /// range of error codes is 100 to 199.
  71. enum ErrorCode: SwiftProtobuf.Enum, Swift.CaseIterable {
  72. typealias RawValue = Int
  73. /// No error at all.
  74. case noError // = 0
  75. /// The temporary URI to download the model has expired.
  76. case uriExpired // = 101
  77. /// There is no network connection when trying to download the model file or
  78. /// the model info.
  79. case noNetworkConnection // = 102
  80. /// The download started on a valid condition but didn't finish successfully.
  81. case downloadFailed // = 104
  82. /// We received an unsuccessful http status code when trying to download the
  83. /// model info. An unsuccessful http status code is a code that's neither 200
  84. /// nor 304. See go/firebase-ml-model-hosting-design for a list of possible
  85. /// status codes while downloading the model info.
  86. case modelInfoDownloadUnsuccessfulHTTPStatus // = 105
  87. /// Didn't receive a model hash while trying to download the model info.
  88. case modelInfoDownloadNoHash // = 106
  89. /// Failed to connect to the Firebase Console while trying to download the
  90. /// model info.
  91. case modelInfoDownloadConnectionFailed // = 107
  92. /// Model hash mismatches the expected value.
  93. case modelHashMismatch // = 116
  94. /// An unknown error has occurred. This is for conditions that should never
  95. /// happen. But we log them anyways. If there is a surge in UNKNOWN error
  96. /// codes, we need to check our code.
  97. case unknownError // = 9999
  98. case UNRECOGNIZED(Int)
  99. init() {
  100. self = .noError
  101. }
  102. init?(rawValue: Int) {
  103. switch rawValue {
  104. case 0: self = .noError
  105. case 101: self = .uriExpired
  106. case 102: self = .noNetworkConnection
  107. case 104: self = .downloadFailed
  108. case 105: self = .modelInfoDownloadUnsuccessfulHTTPStatus
  109. case 106: self = .modelInfoDownloadNoHash
  110. case 107: self = .modelInfoDownloadConnectionFailed
  111. case 116: self = .modelHashMismatch
  112. case 9999: self = .unknownError
  113. default: self = .UNRECOGNIZED(rawValue)
  114. }
  115. }
  116. var rawValue: Int {
  117. switch self {
  118. case .noError: return 0
  119. case .uriExpired: return 101
  120. case .noNetworkConnection: return 102
  121. case .downloadFailed: return 104
  122. case .modelInfoDownloadUnsuccessfulHTTPStatus: return 105
  123. case .modelInfoDownloadNoHash: return 106
  124. case .modelInfoDownloadConnectionFailed: return 107
  125. case .modelHashMismatch: return 116
  126. case .unknownError: return 9999
  127. case .UNRECOGNIZED(let i): return i
  128. }
  129. }
  130. // The compiler won't synthesize support with the UNRECOGNIZED case.
  131. static let allCases: [ErrorCode] = [
  132. .noError,
  133. .uriExpired,
  134. .noNetworkConnection,
  135. .downloadFailed,
  136. .modelInfoDownloadUnsuccessfulHTTPStatus,
  137. .modelInfoDownloadNoHash,
  138. .modelInfoDownloadConnectionFailed,
  139. .modelHashMismatch,
  140. .unknownError,
  141. ]
  142. }
  143. /// Information about various parts of the system: app, Firebase, SDK.
  144. struct SystemInfo: Sendable {
  145. // SwiftProtobuf.Message conformance is added in an extension below. See the
  146. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  147. // methods supported on all messages.
  148. /// The application's unique id. On iOS, this is the bundle ID.
  149. var appID: String = String()
  150. /// Application version string. On iOS, this is "version_number" + "#" + "build_number".
  151. var appVersion: String = String()
  152. /// Uniquely identifiable id associated with the Firebase project. Might be an
  153. /// empty string if the developer does not pass a correct FirebaseOptions with
  154. /// a valid Firebase Project ID.
  155. var firebaseProjectID: String = String()
  156. /// Firebase ML SDK version.
  157. var mlSdkVersion: String = String()
  158. /// The API key of the firebase project.
  159. var apiKey: String = String()
  160. var unknownFields = SwiftProtobuf.UnknownStorage()
  161. init() {}
  162. }
  163. /// Information about models.
  164. struct ModelInfo: Sendable {
  165. // SwiftProtobuf.Message conformance is added in an extension below. See the
  166. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  167. // methods supported on all messages.
  168. /// The name of the model defined by the model creator. This string should be
  169. /// meaningful to the creator and describes what the model does. For example,
  170. /// the name can be "mobile vision face recognition" or "speech to text".
  171. var name: String = String()
  172. /// The version of the model defined by the model creator.
  173. var version: String = String()
  174. /// The expected checksum (SHA256) of the model file. Only hash of models
  175. /// downloaded from cloud is logged.
  176. var hash: String = String()
  177. var modelType: ModelInfo.ModelType = .typeUnknown
  178. var unknownFields = SwiftProtobuf.UnknownStorage()
  179. /// The model type is currently envisioned to be used mainly for model
  180. /// download/update.
  181. enum ModelType: SwiftProtobuf.Enum, Swift.CaseIterable {
  182. typealias RawValue = Int
  183. case typeUnknown // = 0
  184. case custom // = 1
  185. case UNRECOGNIZED(Int)
  186. init() {
  187. self = .typeUnknown
  188. }
  189. init?(rawValue: Int) {
  190. switch rawValue {
  191. case 0: self = .typeUnknown
  192. case 1: self = .custom
  193. default: self = .UNRECOGNIZED(rawValue)
  194. }
  195. }
  196. var rawValue: Int {
  197. switch self {
  198. case .typeUnknown: return 0
  199. case .custom: return 1
  200. case .UNRECOGNIZED(let i): return i
  201. }
  202. }
  203. // The compiler won't synthesize support with the UNRECOGNIZED case.
  204. static let allCases: [ModelInfo.ModelType] = [
  205. .typeUnknown,
  206. .custom,
  207. ]
  208. }
  209. init() {}
  210. }
  211. /// Detailed information about a model.
  212. /// The message used to be named "CustomModelOptions".
  213. struct ModelOptions: Sendable {
  214. // SwiftProtobuf.Message conformance is added in an extension below. See the
  215. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  216. // methods supported on all messages.
  217. /// Inherent properties about the model: name, version, URI, source.
  218. var modelInfo: ModelInfo {
  219. get {return _modelInfo ?? ModelInfo()}
  220. set {_modelInfo = newValue}
  221. }
  222. /// Returns true if `modelInfo` has been explicitly set.
  223. var hasModelInfo: Bool {return self._modelInfo != nil}
  224. /// Clears the value of `modelInfo`. Subsequent reads from it will return its default value.
  225. mutating func clearModelInfo() {self._modelInfo = nil}
  226. /// True if models can be updated.
  227. var isModelUpdateEnabled: Bool = false
  228. var unknownFields = SwiftProtobuf.UnknownStorage()
  229. init() {}
  230. fileprivate var _modelInfo: ModelInfo? = nil
  231. }
  232. /// Information about model downloading. A single model download request may
  233. /// result in multiple log entries. "download_status" in the log entry indicates
  234. /// during which stage it is logged.
  235. /// This message used to be named "CustomModelDownloadLogEvent".
  236. struct ModelDownloadLogEvent: Sendable {
  237. // SwiftProtobuf.Message conformance is added in an extension below. See the
  238. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  239. // methods supported on all messages.
  240. /// Model information and options for downloading.
  241. var options: ModelOptions {
  242. get {return _options ?? ModelOptions()}
  243. set {_options = newValue}
  244. }
  245. /// Returns true if `options` has been explicitly set.
  246. var hasOptions: Bool {return self._options != nil}
  247. /// Clears the value of `options`. Subsequent reads from it will return its default value.
  248. mutating func clearOptions() {self._options = nil}
  249. /// The rough duration of the download. This is not marked as
  250. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  251. /// We delegate the download to OS downloader. We may not be notified
  252. /// when the download completes, such as when the app is killed.
  253. var roughDownloadDurationMs: UInt64 = 0
  254. /// The error code for model download.
  255. var errorCode: ErrorCode = .noError
  256. /// The exact duration of the download. This is not marked as
  257. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  258. /// We know the exact duration when the download is completed while the app is
  259. /// still alive and receives the completed notification from OS downloader.
  260. var exactDownloadDurationMs: UInt64 = 0
  261. /// The download status.
  262. var downloadStatus: ModelDownloadLogEvent.DownloadStatus = .unknownStatus
  263. /// If this field is logged for DownloadStatus.MODEL_INFO_RETRIEVAL_FAILED, it
  264. /// is the http status code from the firebase console. See
  265. /// go/firebase-ml-model-hosting-design. Same on both Android and iOS.
  266. /// If this field is logged for DownloadStatus.FAILED, it is the http status
  267. /// code on iOS, and the DownloadManager's "COLUMN_REASON" value on Android. On
  268. /// iOS, the status code can be a negative integer.
  269. var downloadFailureStatus: Int64 = 0
  270. var unknownFields = SwiftProtobuf.UnknownStorage()
  271. /// The download status. The model download is made up of two major stages: the
  272. /// retrieval of the model info in Firebase backend, and then the download of
  273. /// the model file in GCS. Whether or not the download is requested implicitly
  274. /// or explicitly does not affect the later stages of the download. As a
  275. /// result, later stages (i.e. enum tag 3+) do not distinguish between explicit
  276. /// and implicit triggering.
  277. enum DownloadStatus: SwiftProtobuf.Enum, Swift.CaseIterable {
  278. typealias RawValue = Int
  279. case unknownStatus // = 0
  280. /// The download is requested by the developer, i.e. ensureModelDownloaded()
  281. /// is called.
  282. case explicitlyRequested // = 1
  283. /// The download is requested by the SDK implicitly.
  284. case implicitlyRequested // = 2
  285. /// The retrieval of the model info succeeded.
  286. case modelInfoRetrievalSucceeded // = 3
  287. /// The retrieval of the model info failed. See error_code field for details.
  288. case modelInfoRetrievalFailed // = 4
  289. /// A new download with the OS downloader has been scheduled.
  290. case scheduled // = 5
  291. /// There is an existing downloading session. No new download is scheduled.
  292. case downloading // = 6
  293. /// The download of the model file succeeded.
  294. case succeeded // = 7
  295. /// The download of the model file failed.
  296. case failed // = 8
  297. /// Update is enabled and available while the existing model is downloaded or
  298. /// live.
  299. case updateAvailable // = 10
  300. case UNRECOGNIZED(Int)
  301. init() {
  302. self = .unknownStatus
  303. }
  304. init?(rawValue: Int) {
  305. switch rawValue {
  306. case 0: self = .unknownStatus
  307. case 1: self = .explicitlyRequested
  308. case 2: self = .implicitlyRequested
  309. case 3: self = .modelInfoRetrievalSucceeded
  310. case 4: self = .modelInfoRetrievalFailed
  311. case 5: self = .scheduled
  312. case 6: self = .downloading
  313. case 7: self = .succeeded
  314. case 8: self = .failed
  315. case 10: self = .updateAvailable
  316. default: self = .UNRECOGNIZED(rawValue)
  317. }
  318. }
  319. var rawValue: Int {
  320. switch self {
  321. case .unknownStatus: return 0
  322. case .explicitlyRequested: return 1
  323. case .implicitlyRequested: return 2
  324. case .modelInfoRetrievalSucceeded: return 3
  325. case .modelInfoRetrievalFailed: return 4
  326. case .scheduled: return 5
  327. case .downloading: return 6
  328. case .succeeded: return 7
  329. case .failed: return 8
  330. case .updateAvailable: return 10
  331. case .UNRECOGNIZED(let i): return i
  332. }
  333. }
  334. // The compiler won't synthesize support with the UNRECOGNIZED case.
  335. static let allCases: [ModelDownloadLogEvent.DownloadStatus] = [
  336. .unknownStatus,
  337. .explicitlyRequested,
  338. .implicitlyRequested,
  339. .modelInfoRetrievalSucceeded,
  340. .modelInfoRetrievalFailed,
  341. .scheduled,
  342. .downloading,
  343. .succeeded,
  344. .failed,
  345. .updateAvailable,
  346. ]
  347. }
  348. init() {}
  349. fileprivate var _options: ModelOptions? = nil
  350. }
  351. /// Information about deleting a downloaded model on device.
  352. struct DeleteModelLogEvent: Sendable {
  353. // SwiftProtobuf.Message conformance is added in an extension below. See the
  354. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  355. // methods supported on all messages.
  356. /// The type of the downloaded model requested to be deleted.
  357. var modelType: ModelInfo.ModelType = .typeUnknown
  358. /// Whether the downloaded model is deleted successfully.
  359. var isSuccessful: Bool = false
  360. var unknownFields = SwiftProtobuf.UnknownStorage()
  361. init() {}
  362. }
  363. /// Main log event for FirebaseMl, that contains individual API events, like model
  364. /// download.
  365. /// NEXT ID: 44.
  366. struct FirebaseMlLogEvent: @unchecked Sendable {
  367. // SwiftProtobuf.Message conformance is added in an extension below. See the
  368. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  369. // methods supported on all messages.
  370. /// Information about various parts of the system: app, Firebase, SDK.
  371. var systemInfo: SystemInfo {
  372. get {return _storage._systemInfo ?? SystemInfo()}
  373. set {_uniqueStorage()._systemInfo = newValue}
  374. }
  375. /// Returns true if `systemInfo` has been explicitly set.
  376. var hasSystemInfo: Bool {return _storage._systemInfo != nil}
  377. /// Clears the value of `systemInfo`. Subsequent reads from it will return its default value.
  378. mutating func clearSystemInfo() {_uniqueStorage()._systemInfo = nil}
  379. /// The event name.
  380. var eventName: EventName {
  381. get {return _storage._eventName}
  382. set {_uniqueStorage()._eventName = newValue}
  383. }
  384. /// Information about model download.
  385. var modelDownloadLogEvent: ModelDownloadLogEvent {
  386. get {return _storage._modelDownloadLogEvent ?? ModelDownloadLogEvent()}
  387. set {_uniqueStorage()._modelDownloadLogEvent = newValue}
  388. }
  389. /// Returns true if `modelDownloadLogEvent` has been explicitly set.
  390. var hasModelDownloadLogEvent: Bool {return _storage._modelDownloadLogEvent != nil}
  391. /// Clears the value of `modelDownloadLogEvent`. Subsequent reads from it will return its default value.
  392. mutating func clearModelDownloadLogEvent() {_uniqueStorage()._modelDownloadLogEvent = nil}
  393. /// Information about deleting a downloaded model.
  394. var deleteModelLogEvent: DeleteModelLogEvent {
  395. get {return _storage._deleteModelLogEvent ?? DeleteModelLogEvent()}
  396. set {_uniqueStorage()._deleteModelLogEvent = newValue}
  397. }
  398. /// Returns true if `deleteModelLogEvent` has been explicitly set.
  399. var hasDeleteModelLogEvent: Bool {return _storage._deleteModelLogEvent != nil}
  400. /// Clears the value of `deleteModelLogEvent`. Subsequent reads from it will return its default value.
  401. mutating func clearDeleteModelLogEvent() {_uniqueStorage()._deleteModelLogEvent = nil}
  402. var unknownFields = SwiftProtobuf.UnknownStorage()
  403. init() {}
  404. fileprivate var _storage = _StorageClass.defaultInstance
  405. }
  406. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  407. extension EventName: SwiftProtobuf._ProtoNameProviding {
  408. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNKNOWN_EVENT\0\u{2}d\u{1}MODEL_DOWNLOAD\0\u{1}MODEL_UPDATE\0\u{2}W\u{2}REMOTE_MODEL_DELETE_ON_DEVICE\0")
  409. }
  410. extension ErrorCode: SwiftProtobuf._ProtoNameProviding {
  411. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NO_ERROR\0\u{2}e\u{1}URI_EXPIRED\0\u{1}NO_NETWORK_CONNECTION\0\u{2}\u{2}DOWNLOAD_FAILED\0\u{1}MODEL_INFO_DOWNLOAD_UNSUCCESSFUL_HTTP_STATUS\0\u{1}MODEL_INFO_DOWNLOAD_NO_HASH\0\u{1}MODEL_INFO_DOWNLOAD_CONNECTION_FAILED\0\u{2}\u{9}MODEL_HASH_MISMATCH\0\u{2}[Z\u{2}UNKNOWN_ERROR\0")
  412. }
  413. extension SystemInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  414. static let protoMessageName: String = "SystemInfo"
  415. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}app_id\0\u{3}app_version\0\u{3}firebase_project_id\0\u{3}ml_sdk_version\0\u{4}\u{3}api_key\0")
  416. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  417. while let fieldNumber = try decoder.nextFieldNumber() {
  418. // The use of inline closures is to circumvent an issue where the compiler
  419. // allocates stack space for every case branch when no optimizations are
  420. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  421. switch fieldNumber {
  422. case 1: try { try decoder.decodeSingularStringField(value: &self.appID) }()
  423. case 2: try { try decoder.decodeSingularStringField(value: &self.appVersion) }()
  424. case 3: try { try decoder.decodeSingularStringField(value: &self.firebaseProjectID) }()
  425. case 4: try { try decoder.decodeSingularStringField(value: &self.mlSdkVersion) }()
  426. case 7: try { try decoder.decodeSingularStringField(value: &self.apiKey) }()
  427. default: break
  428. }
  429. }
  430. }
  431. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  432. if !self.appID.isEmpty {
  433. try visitor.visitSingularStringField(value: self.appID, fieldNumber: 1)
  434. }
  435. if !self.appVersion.isEmpty {
  436. try visitor.visitSingularStringField(value: self.appVersion, fieldNumber: 2)
  437. }
  438. if !self.firebaseProjectID.isEmpty {
  439. try visitor.visitSingularStringField(value: self.firebaseProjectID, fieldNumber: 3)
  440. }
  441. if !self.mlSdkVersion.isEmpty {
  442. try visitor.visitSingularStringField(value: self.mlSdkVersion, fieldNumber: 4)
  443. }
  444. if !self.apiKey.isEmpty {
  445. try visitor.visitSingularStringField(value: self.apiKey, fieldNumber: 7)
  446. }
  447. try unknownFields.traverse(visitor: &visitor)
  448. }
  449. static func ==(lhs: SystemInfo, rhs: SystemInfo) -> Bool {
  450. if lhs.appID != rhs.appID {return false}
  451. if lhs.appVersion != rhs.appVersion {return false}
  452. if lhs.firebaseProjectID != rhs.firebaseProjectID {return false}
  453. if lhs.mlSdkVersion != rhs.mlSdkVersion {return false}
  454. if lhs.apiKey != rhs.apiKey {return false}
  455. if lhs.unknownFields != rhs.unknownFields {return false}
  456. return true
  457. }
  458. }
  459. extension ModelInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  460. static let protoMessageName: String = "ModelInfo"
  461. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}version\0\u{2}\u{3}hash\0\u{3}model_type\0")
  462. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  463. while let fieldNumber = try decoder.nextFieldNumber() {
  464. // The use of inline closures is to circumvent an issue where the compiler
  465. // allocates stack space for every case branch when no optimizations are
  466. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  467. switch fieldNumber {
  468. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  469. case 2: try { try decoder.decodeSingularStringField(value: &self.version) }()
  470. case 5: try { try decoder.decodeSingularStringField(value: &self.hash) }()
  471. case 6: try { try decoder.decodeSingularEnumField(value: &self.modelType) }()
  472. default: break
  473. }
  474. }
  475. }
  476. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  477. if !self.name.isEmpty {
  478. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  479. }
  480. if !self.version.isEmpty {
  481. try visitor.visitSingularStringField(value: self.version, fieldNumber: 2)
  482. }
  483. if !self.hash.isEmpty {
  484. try visitor.visitSingularStringField(value: self.hash, fieldNumber: 5)
  485. }
  486. if self.modelType != .typeUnknown {
  487. try visitor.visitSingularEnumField(value: self.modelType, fieldNumber: 6)
  488. }
  489. try unknownFields.traverse(visitor: &visitor)
  490. }
  491. static func ==(lhs: ModelInfo, rhs: ModelInfo) -> Bool {
  492. if lhs.name != rhs.name {return false}
  493. if lhs.version != rhs.version {return false}
  494. if lhs.hash != rhs.hash {return false}
  495. if lhs.modelType != rhs.modelType {return false}
  496. if lhs.unknownFields != rhs.unknownFields {return false}
  497. return true
  498. }
  499. }
  500. extension ModelInfo.ModelType: SwiftProtobuf._ProtoNameProviding {
  501. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0TYPE_UNKNOWN\0\u{1}CUSTOM\0")
  502. }
  503. extension ModelOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  504. static let protoMessageName: String = "ModelOptions"
  505. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}model_info\0\u{4}\u{3}is_model_update_enabled\0")
  506. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  507. while let fieldNumber = try decoder.nextFieldNumber() {
  508. // The use of inline closures is to circumvent an issue where the compiler
  509. // allocates stack space for every case branch when no optimizations are
  510. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  511. switch fieldNumber {
  512. case 1: try { try decoder.decodeSingularMessageField(value: &self._modelInfo) }()
  513. case 4: try { try decoder.decodeSingularBoolField(value: &self.isModelUpdateEnabled) }()
  514. default: break
  515. }
  516. }
  517. }
  518. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  519. // The use of inline closures is to circumvent an issue where the compiler
  520. // allocates stack space for every if/case branch local when no optimizations
  521. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  522. // https://github.com/apple/swift-protobuf/issues/1182
  523. try { if let v = self._modelInfo {
  524. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  525. } }()
  526. if self.isModelUpdateEnabled != false {
  527. try visitor.visitSingularBoolField(value: self.isModelUpdateEnabled, fieldNumber: 4)
  528. }
  529. try unknownFields.traverse(visitor: &visitor)
  530. }
  531. static func ==(lhs: ModelOptions, rhs: ModelOptions) -> Bool {
  532. if lhs._modelInfo != rhs._modelInfo {return false}
  533. if lhs.isModelUpdateEnabled != rhs.isModelUpdateEnabled {return false}
  534. if lhs.unknownFields != rhs.unknownFields {return false}
  535. return true
  536. }
  537. }
  538. extension ModelDownloadLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  539. static let protoMessageName: String = "ModelDownloadLogEvent"
  540. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}options\0\u{3}rough_download_duration_ms\0\u{3}error_code\0\u{3}exact_download_duration_ms\0\u{3}download_status\0\u{3}download_failure_status\0")
  541. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  542. while let fieldNumber = try decoder.nextFieldNumber() {
  543. // The use of inline closures is to circumvent an issue where the compiler
  544. // allocates stack space for every case branch when no optimizations are
  545. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  546. switch fieldNumber {
  547. case 1: try { try decoder.decodeSingularMessageField(value: &self._options) }()
  548. case 2: try { try decoder.decodeSingularUInt64Field(value: &self.roughDownloadDurationMs) }()
  549. case 3: try { try decoder.decodeSingularEnumField(value: &self.errorCode) }()
  550. case 4: try { try decoder.decodeSingularUInt64Field(value: &self.exactDownloadDurationMs) }()
  551. case 5: try { try decoder.decodeSingularEnumField(value: &self.downloadStatus) }()
  552. case 6: try { try decoder.decodeSingularInt64Field(value: &self.downloadFailureStatus) }()
  553. default: break
  554. }
  555. }
  556. }
  557. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  558. // The use of inline closures is to circumvent an issue where the compiler
  559. // allocates stack space for every if/case branch local when no optimizations
  560. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  561. // https://github.com/apple/swift-protobuf/issues/1182
  562. try { if let v = self._options {
  563. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  564. } }()
  565. if self.roughDownloadDurationMs != 0 {
  566. try visitor.visitSingularUInt64Field(value: self.roughDownloadDurationMs, fieldNumber: 2)
  567. }
  568. if self.errorCode != .noError {
  569. try visitor.visitSingularEnumField(value: self.errorCode, fieldNumber: 3)
  570. }
  571. if self.exactDownloadDurationMs != 0 {
  572. try visitor.visitSingularUInt64Field(value: self.exactDownloadDurationMs, fieldNumber: 4)
  573. }
  574. if self.downloadStatus != .unknownStatus {
  575. try visitor.visitSingularEnumField(value: self.downloadStatus, fieldNumber: 5)
  576. }
  577. if self.downloadFailureStatus != 0 {
  578. try visitor.visitSingularInt64Field(value: self.downloadFailureStatus, fieldNumber: 6)
  579. }
  580. try unknownFields.traverse(visitor: &visitor)
  581. }
  582. static func ==(lhs: ModelDownloadLogEvent, rhs: ModelDownloadLogEvent) -> Bool {
  583. if lhs._options != rhs._options {return false}
  584. if lhs.roughDownloadDurationMs != rhs.roughDownloadDurationMs {return false}
  585. if lhs.errorCode != rhs.errorCode {return false}
  586. if lhs.exactDownloadDurationMs != rhs.exactDownloadDurationMs {return false}
  587. if lhs.downloadStatus != rhs.downloadStatus {return false}
  588. if lhs.downloadFailureStatus != rhs.downloadFailureStatus {return false}
  589. if lhs.unknownFields != rhs.unknownFields {return false}
  590. return true
  591. }
  592. }
  593. extension ModelDownloadLogEvent.DownloadStatus: SwiftProtobuf._ProtoNameProviding {
  594. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNKNOWN_STATUS\0\u{1}EXPLICITLY_REQUESTED\0\u{1}IMPLICITLY_REQUESTED\0\u{1}MODEL_INFO_RETRIEVAL_SUCCEEDED\0\u{1}MODEL_INFO_RETRIEVAL_FAILED\0\u{1}SCHEDULED\0\u{1}DOWNLOADING\0\u{1}SUCCEEDED\0\u{1}FAILED\0\u{2}\u{2}UPDATE_AVAILABLE\0")
  595. }
  596. extension DeleteModelLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  597. static let protoMessageName: String = "DeleteModelLogEvent"
  598. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}model_type\0\u{3}is_successful\0")
  599. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  600. while let fieldNumber = try decoder.nextFieldNumber() {
  601. // The use of inline closures is to circumvent an issue where the compiler
  602. // allocates stack space for every case branch when no optimizations are
  603. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  604. switch fieldNumber {
  605. case 1: try { try decoder.decodeSingularEnumField(value: &self.modelType) }()
  606. case 2: try { try decoder.decodeSingularBoolField(value: &self.isSuccessful) }()
  607. default: break
  608. }
  609. }
  610. }
  611. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  612. if self.modelType != .typeUnknown {
  613. try visitor.visitSingularEnumField(value: self.modelType, fieldNumber: 1)
  614. }
  615. if self.isSuccessful != false {
  616. try visitor.visitSingularBoolField(value: self.isSuccessful, fieldNumber: 2)
  617. }
  618. try unknownFields.traverse(visitor: &visitor)
  619. }
  620. static func ==(lhs: DeleteModelLogEvent, rhs: DeleteModelLogEvent) -> Bool {
  621. if lhs.modelType != rhs.modelType {return false}
  622. if lhs.isSuccessful != rhs.isSuccessful {return false}
  623. if lhs.unknownFields != rhs.unknownFields {return false}
  624. return true
  625. }
  626. }
  627. extension FirebaseMlLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  628. static let protoMessageName: String = "FirebaseMlLogEvent"
  629. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}system_info\0\u{3}event_name\0\u{3}model_download_log_event\0\u{4}%delete_model_log_event\0")
  630. fileprivate class _StorageClass {
  631. var _systemInfo: SystemInfo? = nil
  632. var _eventName: EventName = .unknownEvent
  633. var _modelDownloadLogEvent: ModelDownloadLogEvent? = nil
  634. var _deleteModelLogEvent: DeleteModelLogEvent? = nil
  635. // This property is used as the initial default value for new instances of the type.
  636. // The type itself is protecting the reference to its storage via CoW semantics.
  637. // This will force a copy to be made of this reference when the first mutation occurs;
  638. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  639. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  640. private init() {}
  641. init(copying source: _StorageClass) {
  642. _systemInfo = source._systemInfo
  643. _eventName = source._eventName
  644. _modelDownloadLogEvent = source._modelDownloadLogEvent
  645. _deleteModelLogEvent = source._deleteModelLogEvent
  646. }
  647. }
  648. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  649. if !isKnownUniquelyReferenced(&_storage) {
  650. _storage = _StorageClass(copying: _storage)
  651. }
  652. return _storage
  653. }
  654. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  655. _ = _uniqueStorage()
  656. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  657. while let fieldNumber = try decoder.nextFieldNumber() {
  658. // The use of inline closures is to circumvent an issue where the compiler
  659. // allocates stack space for every case branch when no optimizations are
  660. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  661. switch fieldNumber {
  662. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._systemInfo) }()
  663. case 2: try { try decoder.decodeSingularEnumField(value: &_storage._eventName) }()
  664. case 3: try { try decoder.decodeSingularMessageField(value: &_storage._modelDownloadLogEvent) }()
  665. case 40: try { try decoder.decodeSingularMessageField(value: &_storage._deleteModelLogEvent) }()
  666. default: break
  667. }
  668. }
  669. }
  670. }
  671. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  672. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  673. // The use of inline closures is to circumvent an issue where the compiler
  674. // allocates stack space for every if/case branch local when no optimizations
  675. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  676. // https://github.com/apple/swift-protobuf/issues/1182
  677. try { if let v = _storage._systemInfo {
  678. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  679. } }()
  680. if _storage._eventName != .unknownEvent {
  681. try visitor.visitSingularEnumField(value: _storage._eventName, fieldNumber: 2)
  682. }
  683. try { if let v = _storage._modelDownloadLogEvent {
  684. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  685. } }()
  686. try { if let v = _storage._deleteModelLogEvent {
  687. try visitor.visitSingularMessageField(value: v, fieldNumber: 40)
  688. } }()
  689. }
  690. try unknownFields.traverse(visitor: &visitor)
  691. }
  692. static func ==(lhs: FirebaseMlLogEvent, rhs: FirebaseMlLogEvent) -> Bool {
  693. if lhs._storage !== rhs._storage {
  694. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  695. let _storage = _args.0
  696. let rhs_storage = _args.1
  697. if _storage._systemInfo != rhs_storage._systemInfo {return false}
  698. if _storage._eventName != rhs_storage._eventName {return false}
  699. if _storage._modelDownloadLogEvent != rhs_storage._modelDownloadLogEvent {return false}
  700. if _storage._deleteModelLogEvent != rhs_storage._deleteModelLogEvent {return false}
  701. return true
  702. }
  703. if !storagesAreEqual {return false}
  704. }
  705. if lhs.unknownFields != rhs.unknownFields {return false}
  706. return true
  707. }
  708. }