using System.IO.Compression;

namespace ZB.MOM.WW.CBDD.Core.Compression;

/// <summary>
/// Codec abstraction for payload compression and decompression.
/// </summary>
public interface ICompressionCodec
{
    /// <summary>
    /// Codec identifier.
    /// </summary>
    CompressionCodec Codec { get; }

    /// <summary>
    /// Compresses input bytes.
    /// </summary>
    byte[] Compress(ReadOnlySpan<byte> input, CompressionLevel level);

    /// <summary>
    /// Decompresses payload bytes with output bounds validation.
    /// </summary>
    byte[] Decompress(ReadOnlySpan<byte> input, int expectedLength, int maxDecompressedSizeBytes);
}
