using System;

namespace StellaOps.Feedser.Exporter.Json;

/// <summary>
/// Metadata describing a single file produced by the JSON exporter.
/// </summary>
public sealed class JsonExportFile
{
    public JsonExportFile(string relativePath, long length, string digest)
    {
        RelativePath = relativePath ?? throw new ArgumentNullException(nameof(relativePath));
        if (relativePath.Length == 0)
        {
            throw new ArgumentException("Relative path cannot be empty.", nameof(relativePath));
        }

        if (length < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(length));
        }

        Digest = digest ?? throw new ArgumentNullException(nameof(digest));
        if (digest.Length == 0)
        {
            throw new ArgumentException("Digest cannot be empty.", nameof(digest));
        }

        Length = length;
    }

    public string RelativePath { get; }

    public long Length { get; }

    public string Digest { get; }
}
