31 lines
572 B
Swift
31 lines
572 B
Swift
import Foundation
|
|
import GRDB
|
|
|
|
enum MessageType: String, Codable, DatabaseValueConvertible {
|
|
case text
|
|
case image
|
|
case video
|
|
case audio
|
|
case file
|
|
case location
|
|
}
|
|
|
|
struct Message: DBStorable, Equatable {
|
|
static let databaseTableName = "messages"
|
|
|
|
let id: String
|
|
let chatId: String
|
|
let fromJid: String
|
|
let toJid: String
|
|
let timestamp: Date
|
|
let body: String?
|
|
// var isReaded: Bool
|
|
// let subject: String?
|
|
// let threadId: String?
|
|
// let errorType: String?
|
|
|
|
var type: MessageType {
|
|
.text
|
|
}
|
|
}
|