using System;
using System.Collections.Generic;

namespace StellaOps.Auth.Client;

/// <summary>
/// Represents an issued token with metadata.
/// </summary>
public sealed record StellaOpsTokenResult(
    string AccessToken,
    string TokenType,
    DateTimeOffset ExpiresAtUtc,
    IReadOnlyList<string> Scopes,
    string? RefreshToken = null,
    string? IdToken = null,
    string? RawResponse = null)
{
    /// <summary>
    /// Converts the result to a cache entry.
    /// </summary>
    public StellaOpsTokenCacheEntry ToCacheEntry()
        => new(AccessToken, TokenType, ExpiresAtUtc, Scopes, RefreshToken, IdToken);
}
