public static PacketFlowMessage Map(NetworkEvent networkEvent) { return(new PacketFlowMessage() { senderID = -99, senderType = -99, payloadType = networkEvent.Match( nodeAddedEvent => NODE_ADDED_EVENT_TYPE_ID, linkAddedEvent => LINK_ADDED_EVENT_TYPE_ID, packetAddedEvent => PACKET_ADDED_EVENT_TYPE_ID, packetEnqueuedEvent => PACKET_ENQUEUED_EVENT_TYPE_ID, portAssignedEvent => PORT_ASSIGNED_EVENT_TYPE_ID, packetTypeDirectionChanged => PACKET_TYPE_DIRECTION_CHANGED_EVENT_TYPE_ID, packetTransmissionStarted => PACKET_TRANSMISSION_STARTED_EVENT_TYPE_ID, packetTransmissionFinished => PACKET_TRANSMISSION_FINISHED_EVENT_TYPE_ID, packedDequeued => PACKET_DEQUEUED_EVENT_TYPE_ID, packetLost => PACKET_LOST_EVENT_TYPE_ID, packetConsumed => PACKET_CONSUMED_EVENT_TYPE_ID ), payload = JsonUtility.ToJson( networkEvent.Match( nodeAddedEvent => nodeAddedEvent.ToNodeAddedEventTransport(), linkAddedEvent => linkAddedEvent.ToLinkAddedEventTransport(), packetAddedEvent => packetAddedEvent.ToPacketAddedEventTransport(), packetEnqueuedEvent => packetEnqueuedEvent.ToPacketEnqueuedEventTransport(), portAssignedEvent => portAssignedEvent.ToPortAssignedEventTransport(), packetTypeDirectionChangedEvent => packetTypeDirectionChangedEvent.ToPacketTypeDirectionChanged(), packetTransmissionStartedEvent => packetTransmissionStartedEvent.ToPacketTransmissionStartedEventTransport(), packetTransmissionFinishedEvent => packetTransmissionFinishedEvent.ToPackedTransmissionFinishedEventTransport(), packetDequeued => packetDequeued.ToPacketDequeuedEventTransport(), packetLost => { throw new NotImplementedException(); }, packetConsumed => { throw new NotImplementedException(); } //TODO: Mapping! ) ) }); }