import Foundation
import Observation
#if canImport(UIKit)
import UIKit
#endif

@Observable
@MainActor
public final class ClipboardBridge {
    public var isEnabled: Bool

    public init(isEnabled: Bool = true) {
        self.isEnabled = isEnabled
    }

    public func readLocal() -> String? {
        guard isEnabled else { return nil }
        return ClipboardSink.read()
    }

    public func writeLocal(_ text: String) {
        guard isEnabled else { return }
        ClipboardSink.set(text)
    }
}
