 public final class ContextToken: Hashable {
 
     public let context: Context
-    fileprivate weak var contextAware: ContextAware?
+    fileprivate weak var contextNode: ContextNode?
 
     fileprivate init(context: Context) {
         self.context = context

    }
}

// MARK: - ContextAware

public protocol ContextAware: class {

    func contextAvailable()
}

fileprivate struct ContextAwareKeys {

    static var contextTokenKey: Void = ()
}

extension ContextAware {

    var contextToken: ContextToken? {
        get { return AssociatedUtils.retrieveValue(for: self, key: &ContextAwareKeys.contextTokenKey) }
        set { AssociatedUtils.store(for: self, key: &ContextAwareKeys.contextTokenKey, storage: .strongOrNil(object: newValue)) }
    }
}

public extension ContextAware {

    public var context: Context {
        return self.contextToken!.context


// MARK: - ContextService

public protocol ContextServiceNode: class {

    var context: Context? { get set } // Fulfilled by extension

    func added(to context: Context)
    func removed(from context: Context)
}

public protocol ContextService: ContextServiceNode {
    associatedtype Component

    var component: Component { get }
}

fileprivate struct ContextServiceNodeKeys {

    static var contextKey: Void = ()
}

public extension ContextServiceNode {

    public var context: Context? {
        get { return AssociatedUtils.retrieveValue(for: self, key: &ContextServiceNodeKeys.contextKey) }
        set { AssociatedUtils.store(for: self, key: &ContextServiceNodeKeys.contextKey, storage: .weakOrNil(object: newValue)) }
    }

    public func added(to context: Context) {
    }

    public func removed(from context: Context) {
    }
}

