import Foundation
import SwiftUI

final class LocalizedPost: ObservableObject {

    unowned let content: Content

    @Published
    var title: String

    @Published
    var text: String

    @Published
    var lastModified: Date?

    @Published
    var images: [FileResource]

    @Published
    var linkPreviewImage: FileResource?

    @Published
    var linkPreviewTitle: String?

    @Published
    var linkPreviewDescription: String?

    init(content: Content,
         title: String? = nil,
         text: String,
         lastModified: Date? = nil,
         images: [FileResource] = [],
         linkPreviewImage: FileResource? = nil,
         linkPreviewTitle: String? = nil,
         linkPreviewDescription: String? = nil) {
        self.content = content
        self.title = title ?? ""
        self.text = text
        self.lastModified = lastModified
        self.images = images
        self.linkPreviewImage = linkPreviewImage
        self.linkPreviewTitle = linkPreviewTitle
        self.linkPreviewDescription = linkPreviewDescription
    }
}

extension LocalizedPost: LinkPreviewItem {

}
