// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using Atom.Core.Diagnostics;
using Atom.Core.Game;
using Atom.Core.Networking;
using Atom.Core.Networking.Messages.Structures.User;

namespace Atom.LoginServer.Logic
{
    internal static class ClientLogic
    {
        private const string VersionKey = "61171cccd528c2bb092174524221ddc9";

        internal static void CheckVersionKey(Client client, string versionKey)
        {
            if (versionKey != VersionKey)
            {
                new PROTO_NC_USER_CLIENT_WRONGVERSION_CHECK_ACK().Send(client);
                return;
            }

            new PROTO_NC_USER_CLIENT_RIGHTVERSION_CHECK_ACK(0, new byte[] { }).Send(client);
        }

        internal static void CheckXTrapKey(Client client, byte[] clientXTrapKey)
        {
            new PROTO_NC_USER_XTRAP_ACK(true).Send(client);
        }

        internal static void Logout(Client client, LogoutType logoutType)
        {
            Log.Info($"Client '{client.Account.Username}' logged out");
        }
    }
}
