firebase_ml_log_sdk.pb.swift 33 KB

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