public class NotificationTrigger {

    public let identifier: Swift.String

    private weak var root: RealityKit.Entity?

    fileprivate init(identifier: Swift.String, root: RealityKit.Entity?) {
        self.identifier = identifier
        self.root = root
    }

    @MainActor
    public func post(overrides: [Swift.String: RealityKit.Entity]? = nil) {
        guard let scene = root?.scene else {
            print("Unable to post notification trigger with identifier \"\(self.identifier)\" because the root is not part of a scene")
            return
        }

        var userInfo: [Swift.String: Any] = [
            "RealityKit.NotificationTrigger.Scene": scene,
            "RealityKit.NotificationTrigger.Identifier": self.identifier
        ]
        userInfo["RealityKit.NotificationTrigger.Overrides"] = overrides

        Foundation.NotificationCenter.default.post(name: Foundation.NSNotification.Name(rawValue: "RealityKit.NotificationTrigger"), object: self, userInfo: userInfo)
    }

}
