 import QRCodeReader
 import MessageUI
 
+
+fileprivate enum ConnectionState
+{
+	case disconnected, joined, hosting
+	
+	var actionText: String
+	{
+		var text = ""
+		
+		switch self
+		{
+		case .disconnected: text = "Disconnect"
+		case .joined: text = "Join"
+		case .hosting: text = "Host"
+		}
+		
+		return NSLocalizedString(text, comment: "A label for an action that changes an online state")
+	}
+	
+	var processingText: String
+	{
+		var text = ""
+		
+		switch self
+		{
+		case .disconnected: text = "Disconnecting"
+		case .joined: text = "Joining"
+		case .hosting: text = "Hosting"
+		}
+		
+		return NSLocalizedString(text, comment: "A label for a processing online state")
+	}
+	
+	var ongoingText: String
+	{
+		var text = ""
+		
+		switch self
+		{
+		case .disconnected: text = "Disconnected"
+		case .joined: text = "Joined"
+		case .hosting: text = "Hosting"
+		}
+		
+		return NSLocalizedString(text, comment: "A label for an ongoing online state")
+	}
+}
+
 @IBDesignable class ConnectionUIView: CustomXibView, QRCodeReaderViewControllerDelegate, UITableViewDataSource, UITableViewDelegate, MFMailComposeViewControllerDelegate, ConnectionListener
 {
 	// OUTLETS	--------------

		return QRCodeReaderViewController(builder: builder)
	}()
	
	
	// INIT	--------------------
	

			
			if P2PClientSession.isConnected
			{
				selectConnectionState(.joined)
				onlineStatusView.isHidden = false
			}
			else
			{
				onlineStatusView.isHidden = true
				
				if joining
				{
					selectConnectionState(.joined, isProcessing: true)
				}
				else
				{
					selectConnectionState(.disconnected)
				}
			}
		}
		
