mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
Swift
40 lines
1.0 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import GRDB
|
|
import SessionUtilitiesKit
|
|
|
|
public struct ConfigDump: Codable, Equatable, Hashable, Identifiable, FetchableRecord, PersistableRecord, TableRecord, ColumnExpressible {
|
|
public static var databaseTableName: String { "configDump" }
|
|
|
|
public typealias Columns = CodingKeys
|
|
public enum CodingKeys: String, CodingKey, ColumnExpression {
|
|
case variant
|
|
case data
|
|
}
|
|
|
|
public enum Variant: String, Codable, DatabaseValueConvertible, CaseIterable {
|
|
case userProfile
|
|
case contacts
|
|
}
|
|
|
|
public var id: Variant { variant }
|
|
|
|
/// The type of config this dump is for
|
|
public let variant: Variant
|
|
|
|
/// The data for this dump
|
|
public let data: Data
|
|
}
|
|
|
|
// MARK: - Convenience
|
|
|
|
public extension ConfigDump.Variant {
|
|
var configMessageKind: SharedConfigMessage.Kind {
|
|
switch self {
|
|
case .userProfile: return .userProfile
|
|
case .contacts: return .contacts
|
|
}
|
|
}
|
|
}
|