using System.Collections.Immutable;
using System.Linq;
using ComputeSharp.SourceGeneration.Helpers;
using Microsoft.CodeAnalysis;
namespace ComputeSharp.SourceGeneration.Models;
///
/// A model for a serializeable diagnostic info to be reconstructed later in a pipeline.
///
/// The wrapped instance.
/// The diagnostic arguments.
internal sealed record DeferredDiagnosticInfo(DiagnosticDescriptor Descriptor, EquatableArray Arguments)
{
///
/// Creates a new instance with the specified parameters.
///
/// The input for the diagnostics to create.
/// The optional arguments for the formatted message to include.
/// A new instance with the specified parameters.
public static DeferredDiagnosticInfo Create(DiagnosticDescriptor descriptor, params object[] args)
{
return new(descriptor, args.Select(static arg => arg.ToString()).ToImmutableArray());
}
}