using TeleWave.Application.Common.Models;

namespace TeleWave.Application.Common.Interfaces;

public sealed record IssuedRefreshToken(string RawToken, DateTimeOffset ExpiresAt);

public sealed record RotatedRefreshToken(Guid UserId, string RawToken, DateTimeOffset ExpiresAt);

public interface IRefreshTokenService
{
    Task<IssuedRefreshToken> IssueAsync(Guid userId, CancellationToken cancellationToken);

    Task<Result<RotatedRefreshToken>> RotateAsync(
        string rawToken,
        CancellationToken cancellationToken
    );

    Task RevokeAsync(string rawToken, CancellationToken cancellationToken);
}
