using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FrameworkDAL.DTO.SessionStore;
namespace FrameworkDAL.CustomCode.SessionStore
{
public interface ISessionStoreDAL
{
///
/// Upserts a session row into MSESSIONSTORE in the GB5 system database.
/// Inserts if the (SERVERCONFIGID, LOGINEVENTLOGID) pair does not exist;
/// otherwise updates LASTLOGINUSEDTIME.
///
Task UpsertSessionAsync(SessionStoreDTO dto, CancellationToken ct = default);
///
/// Updates LASTLOGINUSEDTIME for an existing session (activity heartbeat).
/// Checks session existence before updating to guard against phantom writes.
///
Task UpdateSessionAsync(int serverConfigId, int loginEventLogId, DateTime lastUsedTime, CancellationToken ct = default);
///
/// Deletes the session row from MSESSIONSTORE on logout.
///
Task DeleteSessionAsync(int serverConfigId, int loginEventLogId, CancellationToken ct = default);
///
/// Returns the count of session rows matching (SERVERCONFIGID, LOGINEVENTLOGID).
///
Task GetSessionCountAsync(int serverConfigId, int loginEventLogId, CancellationToken ct = default);
///
/// Returns idle sessions that have exceeded the configured expiry window.
/// Used by the auto-logout background job.
///
Task> GetUnusedSessionsAsync(int serverConfigId, int expiryMinutes, CancellationToken ct = default);
///
/// Deletes stale session rows (older than todayDate or orphaned GB5ADMIN rows).
///
Task DeleteOldSessionsAsync(DateTime todayDate, CancellationToken ct = default);
}
}