﻿using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Client;
using WSSRLib.Interfaces;

namespace WSSRLib.Hubs
{
    public class AuthHub : IAuthHub
    {
        public AuthHub(IHubProxy hubproxy)
        {
            HubProxy = hubproxy;
        }

        public IHubProxy HubProxy { get; set; }

        public string DoAuth(string username, string password)
        {
            return HubProxy.Invoke<string>("DoAuth", username, password).Result;
        }

        public async Task<string> DoAuthAsync(string username, string password)
        {
            return await HubProxy.Invoke<string>("DoAuth", username, password);
        }

        public string DoAuthW2FA(string username, string password, string fa2code)
        {
            return HubProxy.Invoke<string>("DoAuthW2FA", username, password, fa2code).Result;
        }

        public async Task<string> DoAuthW2FAAsync(string username, string password, string fa2code)
        {
            return await HubProxy.Invoke<string>("DoAuthW2FA", username, password, fa2code);
        }
    }
}