using System.Security.Claims;
using Microsoft.IdentityModel.Tokens;

namespace adas_core.Authentication.Interfaces;

public interface ITokenService
{
    int RefreshTokenValidityInDays { get; }
    /// <summary>
    /// Retrieves a <see cref="SecurityToken"/> associated with the specified username and claims.
    /// Returns <see langword="null"/> when no matching token is found.
    /// </summary>
    /// <param name="username">The username used to look up the security token.</param>
    /// <param name="claims">The list of claims associated with the token.</param>
    /// <returns>A <see cref="SecurityToken"/> if a matching token is found; otherwise, <see langword="null"/>.</returns>
    SecurityToken? GetToken(string username, List<Claim> claims);

    /// <summary>
    /// Retrieves the current refresh token used to obtain new access tokens for authentication.
    /// </summary>
    /// <returns>The refresh token as a string.</returns>
    string GetRefreshToken();

    /// <summary>
    /// Serializes the specified security token into its string representation.
    /// </summary>
    /// <param name="token">The security token to serialize.</param>
    /// <returns>A string containing the serialized form of the security token.</returns>
    string Serialize(SecurityToken token);
}