39 lines
735 B
Swift
39 lines
735 B
Swift
|
import Foundation
|
||
|
import GRDB
|
||
|
import Martin
|
||
|
|
||
|
enum MessageType: String, Codable, DatabaseValueConvertible {
|
||
|
case chat
|
||
|
case groupchat
|
||
|
case error
|
||
|
}
|
||
|
|
||
|
enum MessageContentType: Codable & Equatable, DatabaseValueConvertible {
|
||
|
case text
|
||
|
case typing
|
||
|
}
|
||
|
|
||
|
enum MessageStatus: Int, Codable, DatabaseValueConvertible {
|
||
|
case pending
|
||
|
case sent
|
||
|
case error
|
||
|
}
|
||
|
|
||
|
struct Message: DBStorable, Equatable {
|
||
|
static let databaseTableName = "messages"
|
||
|
|
||
|
let id: String
|
||
|
let type: MessageType
|
||
|
let date: Date
|
||
|
let contentType: MessageContentType
|
||
|
let status: MessageStatus
|
||
|
|
||
|
let from: String
|
||
|
let to: String?
|
||
|
|
||
|
let body: String?
|
||
|
let subject: String?
|
||
|
let thread: String?
|
||
|
let oobUrl: String?
|
||
|
}
|