# 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.OcrElementConfig do
  @moduledoc """
  Configuration for OCR element extraction.

  Controls how OCR elements are extracted and filtered.
  """

  @typedoc "Configuration for OCR element extraction."
  @type t :: %__MODULE__{
          include_elements: boolean(),
          min_level: String.t() | nil,
          min_confidence: float(),
          build_hierarchy: boolean()
        }

  defstruct include_elements: false,
            min_level: :line,
            min_confidence: 0.0,
            build_hierarchy: false

  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
