# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef
defmodule Kreuzberg.ArchiveMetadata do
  @moduledoc """
  Archive (ZIP/TAR/7Z) metadata.

  Extracted from compressed archive files containing file lists and size information.
  """

  @typedoc "Archive (ZIP/TAR/7Z) metadata."
  @type t :: %__MODULE__{
          format: String.t() | nil,
          file_count: non_neg_integer(),
          file_list: [String.t()],
          total_size: non_neg_integer(),
          compressed_size: non_neg_integer() | nil
        }

  defstruct format: nil,
            file_count: 0,
            file_list: [],
            total_size: 0,
            compressed_size: nil

  defimpl Jason.Encoder do
    @doc false
    def encode(value, opts) do
      value
      |> Map.from_struct()
      |> Enum.reject(fn {_k, v} -> v == nil end)
      |> Enum.into(%{})
      |> Jason.Encoder.encode(opts)
    end
  end
end
