another.im-ios/ConversationsClassic/AppCore/Models/Attachment.swift
2024-07-10 13:09:59 +02:00

37 lines
824 B
Swift

import Foundation
import GRDB
import Martin
import SwiftUI
enum AttachmentType: Int, Stateable, DatabaseValueConvertible {
case movie = 0
case image = 1
case audio = 2
case file = 3
case location = 4
case contact = 5
}
struct AttachmentItem: DBStorable {
static let databaseTableName = "attachment_items"
let id: String
static let attachment = belongsTo(Attachment.self)
let type: AttachmentType
let localPath: URL?
let remotePath: URL?
let localThumbnailPath: URL?
let string: String?
}
struct Attachment: DBStorable {
static let databaseTableName = "attachments"
let id: String
static let items = hasMany(AttachmentItem.self)
static let message = hasOne(Message.self)
}
extension AttachmentItem: Equatable {}
extension Attachment: Equatable {}