import GRDB

public struct MessageRecord: Codable, FetchableRecord, PersistableRecord, Sendable {
	public static let databaseTableName = "message"

	public var id: String
	public var accountId: String
	public var mailboxId: String
	public var uid: Int
	public var messageId: String?
	public var inReplyTo: String?
	public var refs: String?
	public var subject: String?
	public var fromAddress: String?
	public var fromName: String?
	public var toAddresses: String?
	public var ccAddresses: String?
	public var date: String
	public var snippet: String?
	public var bodyText: String?
	public var bodyHtml: String?
	public var isRead: Bool
	public var isFlagged: Bool
	public var size: Int

	public init(
		id: String, accountId: String, mailboxId: String, uid: Int,
		messageId: String?, inReplyTo: String?, refs: String?,
		subject: String?, fromAddress: String?, fromName: String?,
		toAddresses: String?, ccAddresses: String?,
		date: String, snippet: String?, bodyText: String?, bodyHtml: String?,
		isRead: Bool, isFlagged: Bool, size: Int
	) {
		self.id = id
		self.accountId = accountId
		self.mailboxId = mailboxId
		self.uid = uid
		self.messageId = messageId
		self.inReplyTo = inReplyTo
		self.refs = refs
		self.subject = subject
		self.fromAddress = fromAddress
		self.fromName = fromName
		self.toAddresses = toAddresses
		self.ccAddresses = ccAddresses
		self.date = date
		self.snippet = snippet
		self.bodyText = bodyText
		self.bodyHtml = bodyHtml
		self.isRead = isRead
		self.isFlagged = isFlagged
		self.size = size
	}
}
