# 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.PaddleOcrConfig do
  @moduledoc """
  Configuration for PaddleOCR backend.

  Configures PaddleOCR text detection and recognition with multi-language support.
  Uses a builder pattern for convenient configuration.

  # Examples

  ```no_run
  use kreuzberg::PaddleOcrConfig;

  // Create with default English configuration
  let config = PaddleOcrConfig::new("en");

  // Create with custom cache directory
  let config = PaddleOcrConfig::new("ch")
      .with_cache_dir("/path/to/cache".into());

  // Enable table detection
  let config = PaddleOcrConfig::new("en")
      .with_table_detection(true);
  ```
  """

  @typedoc "Configuration for PaddleOCR backend."
  @type t :: %__MODULE__{
          language: String.t() | nil,
          cache_dir: String.t() | nil,
          use_angle_cls: boolean(),
          enable_table_detection: boolean(),
          det_db_thresh: float(),
          det_db_box_thresh: float(),
          det_db_unclip_ratio: float(),
          det_limit_side_len: non_neg_integer(),
          rec_batch_num: non_neg_integer(),
          padding: non_neg_integer(),
          drop_score: float(),
          model_tier: String.t() | nil
        }

  defstruct language: nil,
            cache_dir: nil,
            use_angle_cls: false,
            enable_table_detection: false,
            det_db_thresh: 0.0,
            det_db_box_thresh: 0.0,
            det_db_unclip_ratio: 0.0,
            det_limit_side_len: 0,
            rec_batch_num: 0,
            padding: 0,
            drop_score: 0.0,
            model_tier: 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
