using System.Diagnostics.CodeAnalysis;
using OliverBooth.Data.Web;
using ISession = OliverBooth.Data.Blog.ISession;
namespace OliverBooth.Services;
public interface ISessionService
{
///
/// Creates a new session for the specified user.
///
/// The HTTP request.
/// The user.
/// The newly-created session.
///
/// is .
/// -or-
/// is .
///
ISession CreateSession(HttpRequest request, IUser user);
///
/// Deletes the specified session.
///
/// The session to delete.
/// is .
void DeleteSession(ISession session);
///
/// Attempts to find a session with the specified ID.
///
/// The session ID.
///
/// When this method returns, contains the session with the specified ID, if the session is found; otherwise,
/// .
///
///
/// if a session with the specified ID is found; otherwise, .
///
bool TryGetSession(Guid sessionId, [NotNullWhen(true)] out ISession? session);
///
/// Attempts to find the session associated with the HTTP request.
///
/// The HTTP request.
///
/// When this method returns, contains the session with the specified request, if the user is found; otherwise,
/// .
///
///
/// to include invalid sessions in the search; otherwise, .
///
/// if the session was found; otherwise, .
/// is .
bool TryGetSession(HttpRequest request, [NotNullWhen(true)] out ISession? session, bool includeInvalid = false);
}