import SwiftUI

struct LinkPreviewDetailView: View {

    @ObservedObject
    var linkPreview: LinkPreview

    let fallbackTitle: String?

    let transferImage: (language: ContentLanguage, image: FileResource)?

    var body: some View {
        VStack(alignment: .leading) {
            OptionalStringPropertyView(
                title: "Preview Title",
                text: $linkPreview.title,
                prompt: fallbackTitle,
                footer: "The title to use in a link preview")

            OptionalImagePropertyView(
                title: "Preview Image",
                selectedImage: $linkPreview.image,
                transferImage: transferImage,
                footer: "The image to show in a link preview")

            OptionalTextFieldPropertyView(
                title: "Preview Description",
                text: $linkPreview.description,
                footer: "The description to show in a link preview")
        }
    }
}
