firebase_ml_log_sdk.pb.swift 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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 UNRECOGNIZED(Int)
  39. init() {
  40. self = .unknownEvent
  41. }
  42. init?(rawValue: Int) {
  43. switch rawValue {
  44. case 0: self = .unknownEvent
  45. case 100: self = .modelDownload
  46. case 101: self = .modelUpdate
  47. default: self = .UNRECOGNIZED(rawValue)
  48. }
  49. }
  50. var rawValue: Int {
  51. switch self {
  52. case .unknownEvent: return 0
  53. case .modelDownload: return 100
  54. case .modelUpdate: return 101
  55. case .UNRECOGNIZED(let i): return i
  56. }
  57. }
  58. }
  59. #if swift(>=4.2)
  60. extension EventName: CaseIterable {
  61. // The compiler won't synthesize support with the UNRECOGNIZED case.
  62. static var allCases: [EventName] = [
  63. .unknownEvent,
  64. .modelDownload,
  65. .modelUpdate,
  66. ]
  67. }
  68. #endif // swift(>=4.2)
  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 {
  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. }
  131. #if swift(>=4.2)
  132. extension ErrorCode: CaseIterable {
  133. // The compiler won't synthesize support with the UNRECOGNIZED case.
  134. static var allCases: [ErrorCode] = [
  135. .noError,
  136. .uriExpired,
  137. .noNetworkConnection,
  138. .downloadFailed,
  139. .modelInfoDownloadUnsuccessfulHTTPStatus,
  140. .modelInfoDownloadNoHash,
  141. .modelInfoDownloadConnectionFailed,
  142. .modelHashMismatch,
  143. .unknownError,
  144. ]
  145. }
  146. #endif // swift(>=4.2)
  147. /// Information about various parts of the system: app, Firebase, SDK.
  148. struct SystemInfo {
  149. // SwiftProtobuf.Message conformance is added in an extension below. See the
  150. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  151. // methods supported on all messages.
  152. /// The application's unique id. On iOS, this is the bundle ID.
  153. var appID: String = String()
  154. /// Application version string. On iOS, this is "version_number" + "#" + "build_number".
  155. var appVersion: String = String()
  156. /// Uniquely identifiable id associated with the Firebase project. Might be an
  157. /// empty string if the developer does not pass a correct FirebaseOptions with
  158. /// a valid Firebase Project ID.
  159. var firebaseProjectID: String = String()
  160. /// Firebase ML SDK version.
  161. var mlSdkVersion: String = String()
  162. /// The API key of the firebase project.
  163. var apiKey: String = String()
  164. var unknownFields = SwiftProtobuf.UnknownStorage()
  165. init() {}
  166. }
  167. /// Information about models.
  168. struct ModelInfo {
  169. // SwiftProtobuf.Message conformance is added in an extension below. See the
  170. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  171. // methods supported on all messages.
  172. /// The name of the model defined by the model creator. This string should be
  173. /// meaningful to the creator and describes what the model does. For example,
  174. /// the name can be "mobile vision face recognition" or "speech to text".
  175. var name: String = String()
  176. /// The version of the model defined by the model creator.
  177. var version: String = String()
  178. /// The expected checksum (SHA256) of the model file. Only hash of models
  179. /// downloaded from cloud is logged.
  180. var hash: String = String()
  181. var modelType: ModelInfo.ModelType = .typeUnknown
  182. var unknownFields = SwiftProtobuf.UnknownStorage()
  183. /// The model type is currently envisioned to be used mainly for model
  184. /// download/update.
  185. enum ModelType: SwiftProtobuf.Enum {
  186. typealias RawValue = Int
  187. case typeUnknown // = 0
  188. case custom // = 1
  189. case UNRECOGNIZED(Int)
  190. init() {
  191. self = .typeUnknown
  192. }
  193. init?(rawValue: Int) {
  194. switch rawValue {
  195. case 0: self = .typeUnknown
  196. case 1: self = .custom
  197. default: self = .UNRECOGNIZED(rawValue)
  198. }
  199. }
  200. var rawValue: Int {
  201. switch self {
  202. case .typeUnknown: return 0
  203. case .custom: return 1
  204. case .UNRECOGNIZED(let i): return i
  205. }
  206. }
  207. }
  208. init() {}
  209. }
  210. #if swift(>=4.2)
  211. extension ModelInfo.ModelType: CaseIterable {
  212. // The compiler won't synthesize support with the UNRECOGNIZED case.
  213. static var allCases: [ModelInfo.ModelType] = [
  214. .typeUnknown,
  215. .custom,
  216. ]
  217. }
  218. #endif // swift(>=4.2)
  219. /// Detailed information about a model.
  220. /// The message used to be named "CustomModelOptions".
  221. struct ModelOptions {
  222. // SwiftProtobuf.Message conformance is added in an extension below. See the
  223. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  224. // methods supported on all messages.
  225. /// Inherent properties about the model: name, version, URI, source.
  226. var modelInfo: ModelInfo {
  227. get {return _modelInfo ?? ModelInfo()}
  228. set {_modelInfo = newValue}
  229. }
  230. /// Returns true if `modelInfo` has been explicitly set.
  231. var hasModelInfo: Bool {return self._modelInfo != nil}
  232. /// Clears the value of `modelInfo`. Subsequent reads from it will return its default value.
  233. mutating func clearModelInfo() {self._modelInfo = nil}
  234. /// True if models can be updated.
  235. var isModelUpdateEnabled: Bool = false
  236. var unknownFields = SwiftProtobuf.UnknownStorage()
  237. init() {}
  238. fileprivate var _modelInfo: ModelInfo? = nil
  239. }
  240. /// Information about model downloading. A single model download request may
  241. /// result in multiple log entries. "download_status" in the log entry indicates
  242. /// during which stage it is logged.
  243. /// This message used to be named "CustomModelDownloadLogEvent".
  244. struct ModelDownloadLogEvent {
  245. // SwiftProtobuf.Message conformance is added in an extension below. See the
  246. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  247. // methods supported on all messages.
  248. /// Model information and options for downloading.
  249. var options: ModelOptions {
  250. get {return _options ?? ModelOptions()}
  251. set {_options = newValue}
  252. }
  253. /// Returns true if `options` has been explicitly set.
  254. var hasOptions: Bool {return self._options != nil}
  255. /// Clears the value of `options`. Subsequent reads from it will return its default value.
  256. mutating func clearOptions() {self._options = nil}
  257. /// The rough duration of the download. This is not marked as
  258. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  259. /// We delegate the download to OS downloader. We may not be notified
  260. /// when the download completes, such as when the app is killed.
  261. var roughDownloadDurationMs: UInt64 = 0
  262. /// The error code for model download.
  263. var errorCode: ErrorCode = .noError
  264. /// The exact duration of the download. This is not marked as
  265. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  266. /// We know the exact duration when the download is completed while the app is
  267. /// still alive and receives the completed notification from OS downloader.
  268. var exactDownloadDurationMs: UInt64 = 0
  269. /// The download status.
  270. var downloadStatus: ModelDownloadLogEvent.DownloadStatus = .unknownStatus
  271. /// If this field is logged for DownloadStatus.MODEL_INFO_RETRIEVAL_FAILED, it
  272. /// is the http status code from the firebase console. See
  273. /// go/firebase-ml-model-hosting-design. Same on both Android and iOS.
  274. /// If this field is logged for DownloadStatus.FAILED, it is the http status
  275. /// code on iOS, and the DownloadManager's "COLUMN_REASON" value on Android. On
  276. /// iOS, the status code can be a negative integer.
  277. var downloadFailureStatus: Int64 = 0
  278. var unknownFields = SwiftProtobuf.UnknownStorage()
  279. /// The download status. The model download is made up of two major stages: the
  280. /// retrieval of the model info in Firebase backend, and then the download of
  281. /// the model file in GCS. Whether or not the download is requested implicitly
  282. /// or explicitly does not affect the later stages of the download. As a
  283. /// result, later stages (i.e. enum tag 3+) do not distinguish between explicit
  284. /// and implicit triggering.
  285. enum DownloadStatus: SwiftProtobuf.Enum {
  286. typealias RawValue = Int
  287. case unknownStatus // = 0
  288. /// The download is requested by the developer, i.e. ensureModelDownloaded()
  289. /// is called.
  290. case explicitlyRequested // = 1
  291. /// The download is requested by the SDK implicitly.
  292. case implicitlyRequested // = 2
  293. /// The retrieval of the model info succeeded.
  294. case modelInfoRetrievalSucceeded // = 3
  295. /// The retrieval of the model info failed. See error_code field for details.
  296. case modelInfoRetrievalFailed // = 4
  297. /// A new download with the OS downloader has been scheduled.
  298. case scheduled // = 5
  299. /// There is an existing downloading session. No new download is scheduled.
  300. case downloading // = 6
  301. /// The download of the model file succeeded.
  302. case succeeded // = 7
  303. /// The download of the model file failed.
  304. case failed // = 8
  305. /// Update is enabled and available while the existing model is downloaded or
  306. /// live.
  307. case updateAvailable // = 10
  308. case UNRECOGNIZED(Int)
  309. init() {
  310. self = .unknownStatus
  311. }
  312. init?(rawValue: Int) {
  313. switch rawValue {
  314. case 0: self = .unknownStatus
  315. case 1: self = .explicitlyRequested
  316. case 2: self = .implicitlyRequested
  317. case 3: self = .modelInfoRetrievalSucceeded
  318. case 4: self = .modelInfoRetrievalFailed
  319. case 5: self = .scheduled
  320. case 6: self = .downloading
  321. case 7: self = .succeeded
  322. case 8: self = .failed
  323. case 10: self = .updateAvailable
  324. default: self = .UNRECOGNIZED(rawValue)
  325. }
  326. }
  327. var rawValue: Int {
  328. switch self {
  329. case .unknownStatus: return 0
  330. case .explicitlyRequested: return 1
  331. case .implicitlyRequested: return 2
  332. case .modelInfoRetrievalSucceeded: return 3
  333. case .modelInfoRetrievalFailed: return 4
  334. case .scheduled: return 5
  335. case .downloading: return 6
  336. case .succeeded: return 7
  337. case .failed: return 8
  338. case .updateAvailable: return 10
  339. case .UNRECOGNIZED(let i): return i
  340. }
  341. }
  342. }
  343. init() {}
  344. fileprivate var _options: ModelOptions? = nil
  345. }
  346. #if swift(>=4.2)
  347. extension ModelDownloadLogEvent.DownloadStatus: CaseIterable {
  348. // The compiler won't synthesize support with the UNRECOGNIZED case.
  349. static var allCases: [ModelDownloadLogEvent.DownloadStatus] = [
  350. .unknownStatus,
  351. .explicitlyRequested,
  352. .implicitlyRequested,
  353. .modelInfoRetrievalSucceeded,
  354. .modelInfoRetrievalFailed,
  355. .scheduled,
  356. .downloading,
  357. .succeeded,
  358. .failed,
  359. .updateAvailable,
  360. ]
  361. }
  362. #endif // swift(>=4.2)
  363. /// Main log event for FirebaseMl, that contains individual API events, like model
  364. /// download.
  365. /// NEXT ID: 44.
  366. struct FirebaseMlLogEvent {
  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 _systemInfo ?? SystemInfo()}
  373. set {_systemInfo = newValue}
  374. }
  375. /// Returns true if `systemInfo` has been explicitly set.
  376. var hasSystemInfo: Bool {return self._systemInfo != nil}
  377. /// Clears the value of `systemInfo`. Subsequent reads from it will return its default value.
  378. mutating func clearSystemInfo() {self._systemInfo = nil}
  379. /// The event name.
  380. var eventName: EventName = .unknownEvent
  381. /// Model downloading logs.
  382. /// ==========================
  383. var modelDownloadLogEvent: ModelDownloadLogEvent {
  384. get {return _modelDownloadLogEvent ?? ModelDownloadLogEvent()}
  385. set {_modelDownloadLogEvent = newValue}
  386. }
  387. /// Returns true if `modelDownloadLogEvent` has been explicitly set.
  388. var hasModelDownloadLogEvent: Bool {return self._modelDownloadLogEvent != nil}
  389. /// Clears the value of `modelDownloadLogEvent`. Subsequent reads from it will return its default value.
  390. mutating func clearModelDownloadLogEvent() {self._modelDownloadLogEvent = nil}
  391. var unknownFields = SwiftProtobuf.UnknownStorage()
  392. init() {}
  393. fileprivate var _systemInfo: SystemInfo? = nil
  394. fileprivate var _modelDownloadLogEvent: ModelDownloadLogEvent? = nil
  395. }
  396. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  397. extension EventName: SwiftProtobuf._ProtoNameProviding {
  398. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  399. 0: .same(proto: "UNKNOWN_EVENT"),
  400. 100: .same(proto: "MODEL_DOWNLOAD"),
  401. 101: .same(proto: "MODEL_UPDATE"),
  402. ]
  403. }
  404. extension ErrorCode: SwiftProtobuf._ProtoNameProviding {
  405. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  406. 0: .same(proto: "NO_ERROR"),
  407. 101: .same(proto: "URI_EXPIRED"),
  408. 102: .same(proto: "NO_NETWORK_CONNECTION"),
  409. 104: .same(proto: "DOWNLOAD_FAILED"),
  410. 105: .same(proto: "MODEL_INFO_DOWNLOAD_UNSUCCESSFUL_HTTP_STATUS"),
  411. 106: .same(proto: "MODEL_INFO_DOWNLOAD_NO_HASH"),
  412. 107: .same(proto: "MODEL_INFO_DOWNLOAD_CONNECTION_FAILED"),
  413. 116: .same(proto: "MODEL_HASH_MISMATCH"),
  414. 9999: .same(proto: "UNKNOWN_ERROR"),
  415. ]
  416. }
  417. extension SystemInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  418. static let protoMessageName: String = "SystemInfo"
  419. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  420. 1: .standard(proto: "app_id"),
  421. 2: .standard(proto: "app_version"),
  422. 3: .standard(proto: "firebase_project_id"),
  423. 4: .standard(proto: "ml_sdk_version"),
  424. 7: .standard(proto: "api_key"),
  425. ]
  426. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  427. while let fieldNumber = try decoder.nextFieldNumber() {
  428. // The use of inline closures is to circumvent an issue where the compiler
  429. // allocates stack space for every case branch when no optimizations are
  430. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  431. switch fieldNumber {
  432. case 1: try { try decoder.decodeSingularStringField(value: &self.appID) }()
  433. case 2: try { try decoder.decodeSingularStringField(value: &self.appVersion) }()
  434. case 3: try { try decoder.decodeSingularStringField(value: &self.firebaseProjectID) }()
  435. case 4: try { try decoder.decodeSingularStringField(value: &self.mlSdkVersion) }()
  436. case 7: try { try decoder.decodeSingularStringField(value: &self.apiKey) }()
  437. default: break
  438. }
  439. }
  440. }
  441. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  442. if !self.appID.isEmpty {
  443. try visitor.visitSingularStringField(value: self.appID, fieldNumber: 1)
  444. }
  445. if !self.appVersion.isEmpty {
  446. try visitor.visitSingularStringField(value: self.appVersion, fieldNumber: 2)
  447. }
  448. if !self.firebaseProjectID.isEmpty {
  449. try visitor.visitSingularStringField(value: self.firebaseProjectID, fieldNumber: 3)
  450. }
  451. if !self.mlSdkVersion.isEmpty {
  452. try visitor.visitSingularStringField(value: self.mlSdkVersion, fieldNumber: 4)
  453. }
  454. if !self.apiKey.isEmpty {
  455. try visitor.visitSingularStringField(value: self.apiKey, fieldNumber: 7)
  456. }
  457. try unknownFields.traverse(visitor: &visitor)
  458. }
  459. static func ==(lhs: SystemInfo, rhs: SystemInfo) -> Bool {
  460. if lhs.appID != rhs.appID {return false}
  461. if lhs.appVersion != rhs.appVersion {return false}
  462. if lhs.firebaseProjectID != rhs.firebaseProjectID {return false}
  463. if lhs.mlSdkVersion != rhs.mlSdkVersion {return false}
  464. if lhs.apiKey != rhs.apiKey {return false}
  465. if lhs.unknownFields != rhs.unknownFields {return false}
  466. return true
  467. }
  468. }
  469. extension ModelInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  470. static let protoMessageName: String = "ModelInfo"
  471. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  472. 1: .same(proto: "name"),
  473. 2: .same(proto: "version"),
  474. 5: .same(proto: "hash"),
  475. 6: .standard(proto: "model_type"),
  476. ]
  477. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  478. while let fieldNumber = try decoder.nextFieldNumber() {
  479. // The use of inline closures is to circumvent an issue where the compiler
  480. // allocates stack space for every case branch when no optimizations are
  481. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  482. switch fieldNumber {
  483. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  484. case 2: try { try decoder.decodeSingularStringField(value: &self.version) }()
  485. case 5: try { try decoder.decodeSingularStringField(value: &self.hash) }()
  486. case 6: try { try decoder.decodeSingularEnumField(value: &self.modelType) }()
  487. default: break
  488. }
  489. }
  490. }
  491. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  492. if !self.name.isEmpty {
  493. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  494. }
  495. if !self.version.isEmpty {
  496. try visitor.visitSingularStringField(value: self.version, fieldNumber: 2)
  497. }
  498. if !self.hash.isEmpty {
  499. try visitor.visitSingularStringField(value: self.hash, fieldNumber: 5)
  500. }
  501. if self.modelType != .typeUnknown {
  502. try visitor.visitSingularEnumField(value: self.modelType, fieldNumber: 6)
  503. }
  504. try unknownFields.traverse(visitor: &visitor)
  505. }
  506. static func ==(lhs: ModelInfo, rhs: ModelInfo) -> Bool {
  507. if lhs.name != rhs.name {return false}
  508. if lhs.version != rhs.version {return false}
  509. if lhs.hash != rhs.hash {return false}
  510. if lhs.modelType != rhs.modelType {return false}
  511. if lhs.unknownFields != rhs.unknownFields {return false}
  512. return true
  513. }
  514. }
  515. extension ModelInfo.ModelType: SwiftProtobuf._ProtoNameProviding {
  516. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  517. 0: .same(proto: "TYPE_UNKNOWN"),
  518. 1: .same(proto: "CUSTOM"),
  519. ]
  520. }
  521. extension ModelOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  522. static let protoMessageName: String = "ModelOptions"
  523. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  524. 1: .standard(proto: "model_info"),
  525. 4: .standard(proto: "is_model_update_enabled"),
  526. ]
  527. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  528. while let fieldNumber = try decoder.nextFieldNumber() {
  529. // The use of inline closures is to circumvent an issue where the compiler
  530. // allocates stack space for every case branch when no optimizations are
  531. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  532. switch fieldNumber {
  533. case 1: try { try decoder.decodeSingularMessageField(value: &self._modelInfo) }()
  534. case 4: try { try decoder.decodeSingularBoolField(value: &self.isModelUpdateEnabled) }()
  535. default: break
  536. }
  537. }
  538. }
  539. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  540. if let v = self._modelInfo {
  541. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  542. }
  543. if self.isModelUpdateEnabled != false {
  544. try visitor.visitSingularBoolField(value: self.isModelUpdateEnabled, fieldNumber: 4)
  545. }
  546. try unknownFields.traverse(visitor: &visitor)
  547. }
  548. static func ==(lhs: ModelOptions, rhs: ModelOptions) -> Bool {
  549. if lhs._modelInfo != rhs._modelInfo {return false}
  550. if lhs.isModelUpdateEnabled != rhs.isModelUpdateEnabled {return false}
  551. if lhs.unknownFields != rhs.unknownFields {return false}
  552. return true
  553. }
  554. }
  555. extension ModelDownloadLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  556. static let protoMessageName: String = "ModelDownloadLogEvent"
  557. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  558. 1: .same(proto: "options"),
  559. 2: .standard(proto: "rough_download_duration_ms"),
  560. 3: .standard(proto: "error_code"),
  561. 4: .standard(proto: "exact_download_duration_ms"),
  562. 5: .standard(proto: "download_status"),
  563. 6: .standard(proto: "download_failure_status"),
  564. ]
  565. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  566. while let fieldNumber = try decoder.nextFieldNumber() {
  567. // The use of inline closures is to circumvent an issue where the compiler
  568. // allocates stack space for every case branch when no optimizations are
  569. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  570. switch fieldNumber {
  571. case 1: try { try decoder.decodeSingularMessageField(value: &self._options) }()
  572. case 2: try { try decoder.decodeSingularUInt64Field(value: &self.roughDownloadDurationMs) }()
  573. case 3: try { try decoder.decodeSingularEnumField(value: &self.errorCode) }()
  574. case 4: try { try decoder.decodeSingularUInt64Field(value: &self.exactDownloadDurationMs) }()
  575. case 5: try { try decoder.decodeSingularEnumField(value: &self.downloadStatus) }()
  576. case 6: try { try decoder.decodeSingularInt64Field(value: &self.downloadFailureStatus) }()
  577. default: break
  578. }
  579. }
  580. }
  581. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  582. if let v = self._options {
  583. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  584. }
  585. if self.roughDownloadDurationMs != 0 {
  586. try visitor.visitSingularUInt64Field(value: self.roughDownloadDurationMs, fieldNumber: 2)
  587. }
  588. if self.errorCode != .noError {
  589. try visitor.visitSingularEnumField(value: self.errorCode, fieldNumber: 3)
  590. }
  591. if self.exactDownloadDurationMs != 0 {
  592. try visitor.visitSingularUInt64Field(value: self.exactDownloadDurationMs, fieldNumber: 4)
  593. }
  594. if self.downloadStatus != .unknownStatus {
  595. try visitor.visitSingularEnumField(value: self.downloadStatus, fieldNumber: 5)
  596. }
  597. if self.downloadFailureStatus != 0 {
  598. try visitor.visitSingularInt64Field(value: self.downloadFailureStatus, fieldNumber: 6)
  599. }
  600. try unknownFields.traverse(visitor: &visitor)
  601. }
  602. static func ==(lhs: ModelDownloadLogEvent, rhs: ModelDownloadLogEvent) -> Bool {
  603. if lhs._options != rhs._options {return false}
  604. if lhs.roughDownloadDurationMs != rhs.roughDownloadDurationMs {return false}
  605. if lhs.errorCode != rhs.errorCode {return false}
  606. if lhs.exactDownloadDurationMs != rhs.exactDownloadDurationMs {return false}
  607. if lhs.downloadStatus != rhs.downloadStatus {return false}
  608. if lhs.downloadFailureStatus != rhs.downloadFailureStatus {return false}
  609. if lhs.unknownFields != rhs.unknownFields {return false}
  610. return true
  611. }
  612. }
  613. extension ModelDownloadLogEvent.DownloadStatus: SwiftProtobuf._ProtoNameProviding {
  614. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  615. 0: .same(proto: "UNKNOWN_STATUS"),
  616. 1: .same(proto: "EXPLICITLY_REQUESTED"),
  617. 2: .same(proto: "IMPLICITLY_REQUESTED"),
  618. 3: .same(proto: "MODEL_INFO_RETRIEVAL_SUCCEEDED"),
  619. 4: .same(proto: "MODEL_INFO_RETRIEVAL_FAILED"),
  620. 5: .same(proto: "SCHEDULED"),
  621. 6: .same(proto: "DOWNLOADING"),
  622. 7: .same(proto: "SUCCEEDED"),
  623. 8: .same(proto: "FAILED"),
  624. 10: .same(proto: "UPDATE_AVAILABLE"),
  625. ]
  626. }
  627. extension FirebaseMlLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  628. static let protoMessageName: String = "FirebaseMlLogEvent"
  629. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  630. 1: .standard(proto: "system_info"),
  631. 2: .standard(proto: "event_name"),
  632. 3: .standard(proto: "model_download_log_event"),
  633. ]
  634. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  635. while let fieldNumber = try decoder.nextFieldNumber() {
  636. // The use of inline closures is to circumvent an issue where the compiler
  637. // allocates stack space for every case branch when no optimizations are
  638. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  639. switch fieldNumber {
  640. case 1: try { try decoder.decodeSingularMessageField(value: &self._systemInfo) }()
  641. case 2: try { try decoder.decodeSingularEnumField(value: &self.eventName) }()
  642. case 3: try { try decoder.decodeSingularMessageField(value: &self._modelDownloadLogEvent) }()
  643. default: break
  644. }
  645. }
  646. }
  647. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  648. if let v = self._systemInfo {
  649. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  650. }
  651. if self.eventName != .unknownEvent {
  652. try visitor.visitSingularEnumField(value: self.eventName, fieldNumber: 2)
  653. }
  654. if let v = self._modelDownloadLogEvent {
  655. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  656. }
  657. try unknownFields.traverse(visitor: &visitor)
  658. }
  659. static func ==(lhs: FirebaseMlLogEvent, rhs: FirebaseMlLogEvent) -> Bool {
  660. if lhs._systemInfo != rhs._systemInfo {return false}
  661. if lhs.eventName != rhs.eventName {return false}
  662. if lhs._modelDownloadLogEvent != rhs._modelDownloadLogEvent {return false}
  663. if lhs.unknownFields != rhs.unknownFields {return false}
  664. return true
  665. }
  666. }