private void GetChat(GetChatJSON getChatJSON)
        {
            getChatJSON.Chat = ServerDirectory.FindChat(Client.Username, getChatJSON.FriendUsername);
            string getChat = System.Text.Json.JsonSerializer.Serialize <GetChatJSON>(getChatJSON);

            Client.SendAnswer(getChat);
        }
        public void RequestActivation(string json)
        {
            string request = string.Empty;

            if (json != string.Empty)
            {
                var key = (JObject)JsonConvert.DeserializeObject(json);
                request = key["Key"].Value <string>();
            }
            switch (request)
            {
            case "registration":
                RegistrationJSON registrationJSON = System.Text.Json.JsonSerializer.Deserialize <RegistrationJSON>(json);
                Console.WriteLine($"New Client. Registration request.");
                Console.WriteLine("Requests: " + json);
                Registration(registrationJSON);
                Server.SendUpdateOnline();
                break;

            case "emailconfirmation":
                EmailConfirmationJSON emailConfirmationJSON = System.Text.Json.JsonSerializer.Deserialize <EmailConfirmationJSON>(json);
                Console.WriteLine($"New Client. Email confirmation request.");
                Console.WriteLine("=> Requests: " + json);
                EmailCodeVerification(emailConfirmationJSON);
                break;

            case "authorization":
                AuthorizationJSON authorizationJSON = System.Text.Json.JsonSerializer.Deserialize <AuthorizationJSON>(json);
                Console.WriteLine($"New Client. Authorization request.");
                Console.WriteLine("=> Requests: " + json);
                Authorization(authorizationJSON);
                Server.SendUpdateOnline();
                break;

            case "addfriend":
                AddFriendJSON addFriendJSON = System.Text.Json.JsonSerializer.Deserialize <AddFriendJSON>(json);
                Console.WriteLine($"New Client. Username: {Client.Username} add friend username:{addFriendJSON.FriendUsername}");
                Console.WriteLine("=> Requests: " + json);
                AddFriend(addFriendJSON);
                Server.SendUpdateOnline();
                break;

            case "getfriendlist":
                GetFrindListJSON getFrindListJSON = System.Text.Json.JsonSerializer.Deserialize <GetFrindListJSON>(json);
                Console.WriteLine($"Client Username: {Client.Username}. FriendList request.");
                Console.WriteLine("=> Requests: " + json);
                GetFriendList(getFrindListJSON);
                break;

            case "getchat":
                GetChatJSON getChatJSON = System.Text.Json.JsonSerializer.Deserialize <GetChatJSON>(json);
                Console.WriteLine($"Client Username: {Client.Username}. GetChat request.");
                Console.WriteLine("=> Requests: " + json);
                GetChat(getChatJSON);
                break;

            case "sendmessage":
                SendMessageJSON sendMessageJSON = System.Text.Json.JsonSerializer.Deserialize <SendMessageJSON>(json);
                Console.WriteLine($"Client Username: {Client.Username}. Send message to user {sendMessageJSON.FriendUsername}");
                Console.WriteLine("=> Requests: " + json);
                SendMessage(sendMessageJSON);
                break;

            case "removefriend":
                AddFriendJSON removeFriend = System.Text.Json.JsonSerializer.Deserialize <AddFriendJSON>(json);
                Console.WriteLine($"Client Username: {Client.Username}. Remove friend {removeFriend.FriendUsername}");
                Console.WriteLine("=> Requests: " + json);
                RemoveFriend(removeFriend);
                Server.SendUpdateOnline();
                break;

            case "statusonline":
                StatusOnlineJSON statusOnlineJSON = System.Text.Json.JsonSerializer.Deserialize <StatusOnlineJSON>(json);
                Console.WriteLine($"Client Username: {Client.Username}. Refresh status online.");
                Console.WriteLine("=> Requests: " + json);
                SendOlineStatus(statusOnlineJSON);
                break;

            default:
                Console.WriteLine($"Client IP: {Client.IPClient}. Sent string.Empty request.");
                Client.Close();
                break;
            }
        }