import Foundation
import SwiftUI
import UIKit

public struct VisualEffectView: UIViewRepresentable {
    public enum ViewStyle {
        case dark
        case light
    }

    private var effect: UIVisualEffect?
    public func makeUIView(context _: UIViewRepresentableContext<Self>) -> UIVisualEffectView { UIVisualEffectView() }
    public func updateUIView(_ uiView: UIVisualEffectView, context _: UIViewRepresentableContext<Self>) { uiView.effect = effect }

    public init(style: ViewStyle) {
        switch style {
        case .dark:
            self.effect = UIBlurEffect(style: .dark)
        case .light:
            self.effect = UIBlurEffect(style: .light)
        }
    }
}
