/** One indent step — 0.5 in at 96 CSS px/in (Google Docs default). */
export const DOCS_INDENT_STEP_PX = 36

export const DOCS_MAX_INDENT_LEVEL = 8

export function clampIndentLevel(level: number): number {
  if (!Number.isFinite(level)) return 0
  return Math.max(0, Math.min(DOCS_MAX_INDENT_LEVEL, Math.round(level)))
}

export function nextIndentLevel(current: number, delta: number): number {
  return clampIndentLevel(current + delta)
}

export function indentLevelToMarginPx(level: number): number {
  return clampIndentLevel(level) * DOCS_INDENT_STEP_PX
}

export function isIndentableBlockType(typeName: string): boolean {
  return typeName === "paragraph" || typeName === "heading"
}
