using MealPlan.Api.Models;

namespace MealPlan.Api.Services;

/// <summary>
/// Stores issued refresh tokens. Backed by an in-memory implementation because the
/// existing database schema must not be modified and no migrations may be added.
/// </summary>
public interface IRefreshTokenStore
{
    void Add(RefreshToken token);

    RefreshToken? Get(string token);

    /// <summary>Marks a token revoked. Returns the revoked token if it existed and was active.</summary>
    RefreshToken? Revoke(string token);

    /// <summary>Removes expired/revoked tokens to bound memory usage.</summary>
    void RemoveExpired();
}
