# 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.HeaderMetadata do
  @moduledoc "Header/heading element metadata."

  @typedoc "Header/heading element metadata."
  @type t :: %__MODULE__{
          level: non_neg_integer(),
          text: String.t() | nil,
          id: String.t() | nil,
          depth: non_neg_integer(),
          html_offset: non_neg_integer()
        }

  defstruct level: 0,
            text: nil,
            id: nil,
            depth: 0,
            html_offset: 0

  @doc "Validate that the header level is within valid range (1-6)."
  @spec valid?(t()) :: boolean()
  def valid?(%__MODULE__{level: level}) do
    level >= 1 and level <= 6
  end
end
