namespace MealPlan.Api.Models;

/// <summary>
/// In-memory refresh token record. Stored in a singleton store rather than the database,
/// because the existing schema must not be modified and no migrations may be created.
/// Rotation: every successful refresh invalidates the previous token and issues a new one.
/// </summary>
public class RefreshToken
{
    public string Token { get; set; } = string.Empty;
    public string UserId { get; set; } = string.Empty;
    public DateTime ExpiresAtUtc { get; set; }
    public DateTime CreatedAtUtc { get; set; }
    public bool IsRevoked { get; set; }

    public bool IsActive => !IsRevoked && DateTime.UtcNow < ExpiresAtUtc;
}
