using ColaFlow.Modules.Identity.Domain.Aggregates.Users;

namespace ColaFlow.Modules.Identity.Application.Services;

public interface IRefreshTokenService
{
    /// <summary>
    /// Generate a new refresh token for the user
    /// </summary>
    Task<string> GenerateRefreshTokenAsync(
        User user,
        string? ipAddress = null,
        string? userAgent = null,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Refresh access token using refresh token (with token rotation)
    /// </summary>
    Task<(string accessToken, string refreshToken)> RefreshTokenAsync(
        string refreshToken,
        string? ipAddress = null,
        string? userAgent = null,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Revoke a specific refresh token
    /// </summary>
    Task RevokeTokenAsync(
        string refreshToken,
        string? ipAddress = null,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Revoke all refresh tokens for a user
    /// </summary>
    Task RevokeAllUserTokensAsync(
        Guid userId,
        CancellationToken cancellationToken = default);
}
