using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace StellaOps.Vexer.Core;

public interface IVexExporter
{
    VexExportFormat Format { get; }

    VexContentAddress Digest(VexExportRequest request);

    ValueTask<VexExportResult> SerializeAsync(
        VexExportRequest request,
        Stream output,
        CancellationToken cancellationToken);
}

public sealed record VexExportRequest(
    VexQuery Query,
    ImmutableArray<VexConsensus> Consensus,
    ImmutableArray<VexClaim> Claims,
    DateTimeOffset GeneratedAt);

public sealed record VexExportResult(
    VexContentAddress Digest,
    long BytesWritten,
    ImmutableDictionary<string, string> Metadata);
