2025-06-19 23:24:39 -07:00

141 lines
4.6 KiB
C#

using Microsoft.AspNetCore.SignalR.Client;
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Services.GatewayService
{
public interface IGatewayService
{
// VARIABLES
/// <summary>
/// The Current Room The Current User Is In
/// </summary>
public Room? CurrentRoom { get; }
/// <summary>
/// Is The User Currently In The Lobby?
/// </summary>
public bool InLobby { get; }
/// <summary>
/// The Current Connection To The Gateway
/// </summary>
public HubConnection? HubConnection { get; }
// FUNCTIONS
/// <summary>
/// The Function Used To Connect To The Gateway Server Asynchronously
/// </summary>
/// <returns></returns>
public Task StartAsync();
/// <summary>
/// Stops The Connection To The Gateway Server
/// </summary>
/// <returns></returns>
public Task StopAsync();
/// <summary>
/// Disposes Of The Gateway Connection And Clears Other Variables
/// </summary>
/// <returns></returns>
public Task DisposeAsync();
/// <summary>
/// Joins The Lobby Of The Server
/// </summary>
/// <returns></returns>
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
public Task JoinLobbyAsync();
/// <summary>
/// Joins The Current User To A Room On The Server
/// </summary>
/// <param name="room">Room To Join</param>
/// <returns></returns>
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
public Task JoinRoomAsync(Room room);
/// <summary>
/// Leaves The Current Room The Current User Is In
/// </summary>
/// <returns></returns>
public Task LeaveRoomAsync();
/// <summary>
/// Posts A Message To Whatever Room The User Is In
/// </summary>
/// <param name="message">Message To Post</param>
/// <returns></returns>
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
public Task PostMessageAsync(Message message);
/// <summary>
/// Sends A Direct Message To The Specified User
/// </summary>
/// <param name="user">The User You Wish To DM</param>
/// <param name="currentUser">Yourself</param>
/// <param name="message"></param>
/// <returns></returns>
public Task SendDirectMessageAsync(UserInformationDto user, Message message);
/// <summary>
/// Refreshes Contacts List For A Specified User
/// </summary>
/// <param name="user">The User You Wish To Refresh</param>
/// <param name="currentUser">Yourself</param>
/// <returns></returns>
public Task RefreshContactsForUser(UserInformationDto user);
/// <summary>
/// Updates The Status For The Current User
/// </summary>
/// <param name="status">The Status You Want To Set On The Current User</param>
/// <returns></returns>
public Task UpdateStatus(int status);
// EVENTS
/// <summary>
/// When A Server Message Is Received, This Event Fires
/// </summary>
public event EventHandler OnServerMessageReceived;
/// <summary>
/// When A Client Function/Event Is Received, This Event Fires
/// </summary>
public event EventHandler OnClientFunctionReceived;
/// <summary>
/// When The Client Received A DM, This Event Fires
/// </summary>
public event EventHandler OnDirectMessageReceived;
/// <summary>
/// When The Server Config Is Received, This Event Fires
/// </summary>
public event EventHandler OnServerConfigReceived;
/// <summary>
/// When The Connection To The Gateway Is Lost, This Event Fires
/// </summary>
public event EventHandler OnServerDisconnect;
/// <summary>
/// When The Connection Attempts To Reconnect, This Event Fires
/// </summary>
public event EventHandler OnServerReconnecting;
/// <summary>
/// When the Connection Reconnects, This Event Fires
/// </summary>
public event EventHandler OnServerReconnected;
}
}