import SwiftUI

struct TagPropertyView: View {

    let title: LocalizedStringKey

    @Binding
    var selectedTag: Tag?

    let footer: LocalizedStringKey

    @State
    private var showTagSelectionSheet = false

    var body: some View {
        GenericPropertyView(title: title, footer: footer) {
            HStack {
                Text(selectedTag?.identifier ?? "No tag selected")
                Spacer()
                Button("Select") {
                    showTagSelectionSheet = true
                }
            }
        }
        .sheet(isPresented: $showTagSelectionSheet) {
            TagPickerView(selectedTag: $selectedTag)
        }
    }
}

