# 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.PdfMetadata do
  @moduledoc """
  PDF-specific metadata.

  Contains metadata fields specific to PDF documents that are not in the common
  `Metadata` structure. Common fields like title, authors, keywords, and dates
  are at the `Metadata` level.
  """

  @typedoc "PDF-specific metadata."
  @type t :: %__MODULE__{
          pdf_version: String.t() | nil,
          producer: String.t() | nil,
          is_encrypted: boolean() | nil,
          width: integer() | nil,
          height: integer() | nil,
          page_count: non_neg_integer() | nil
        }

  defstruct pdf_version: nil,
            producer: nil,
            is_encrypted: nil,
            width: nil,
            height: nil,
            page_count: 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
