# 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.ImageExtractionConfig do
  @moduledoc "Image extraction configuration."

  @typedoc "Image extraction configuration."
  @type t :: %__MODULE__{
          extract_images: boolean(),
          target_dpi: integer(),
          max_image_dimension: integer(),
          inject_placeholders: boolean(),
          auto_adjust_dpi: boolean(),
          min_dpi: integer(),
          max_dpi: integer(),
          max_images_per_page: non_neg_integer() | nil,
          classify: boolean(),
          include_page_rasters: boolean(),
          run_ocr_on_images: boolean(),
          ocr_text_only: boolean(),
          append_ocr_text: boolean()
        }

  defstruct extract_images: true,
            target_dpi: 300,
            max_image_dimension: 4_096,
            inject_placeholders: true,
            auto_adjust_dpi: true,
            min_dpi: 72,
            max_dpi: 600,
            max_images_per_page: nil,
            classify: true,
            include_page_rasters: false,
            run_ocr_on_images: true,
            ocr_text_only: false,
            append_ocr_text: 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
