     
     public init(from decoder: Decoder) throws {
         let container = try decoder.container(keyedBy: CodingKeys.self)
-        eventType = SignalingNotificationEventType(rawValue:
-            try container.decode(String.self, forKey: .eventType))!
-        
-        if let raw = try container.decodeIfPresent(String.self, forKey: .role) {
-            role = SignalingRole(rawValue: raw)
-        } else {
-            role = nil
-        }
-        
+        eventType =  try container.decode(SignalingNotificationEventType.self,
+                                          forKey: .eventType)
+        role = try container.decodeIfPresent(SignalingRole.self, forKey: .role)
         connectionTime = try container.decodeIfPresent(Int.self, forKey: .connectionTime)
         connectionCount = try container.decodeIfPresent(Int.self, forKey: .connectionCount)
         publisherCount = try container.decodeIfPresent(Int.self, forKey: .publisherCount)

public enum SignalingNotificationEventType: String {
    
    /// "connection.created"
    case connectionCreated = "connection.created"
    
    /// "connection.updated"
    case connectionUpdated = "connection.updated"
    
    /// "connection.destroyed"
    case connectionDestroyed = "connection.destroyed"
    
    /// "spotlight.changed"
    case spotlightChanged = "spotlight.changed"
    
    /// "network.status"
    case networkStatus = "network.status"
    
}


    
    public func encode(to encoder: Encoder) throws {
        throw SoraError.invalidSignalingMessage
    }
    
}

private var eventTypeTable: PairTable<String, SignalingNotificationEventType> =
    PairTable(name: "SignalingNotificationEventType",
              pairs: [("connection.created", .connectionCreated),
                      ("connection.updated", .connectionUpdated),
                      ("connection.destroyed", .connectionDestroyed),
                      ("spotlight.changed", .spotlightChanged),
                      ("network.status", .networkStatus)])

/// :nodoc:
extension SignalingNotificationEventType: Codable {
    
    public init(from decoder: Decoder) throws {
        self = try eventTypeTable.decode(from: decoder)
    }
    
    public func encode(to encoder: Encoder) throws {
        try eventTypeTable.encode(self, to: encoder)
    }
    
}
