// Generated by alef. Do not edit by hand.
@file:Suppress(
    "ktlint:standard:trailing-comma-on-call-site",
    "ktlint:standard:trailing-comma-on-declaration-site",
    "ktlint:standard:spacing-between-declarations-with-comments",
    "ktlint:standard:spacing-between-declarations-with-annotations",
    "ktlint:standard:when-entry-bracing",
    "ktlint:standard:blank-line-between-when-conditions",
    "ktlint:standard:blank-line-before-declaration",
    "ktlint:standard:chain-method-continuation",
    "ktlint:standard:annotation",
    "ktlint:standard:max-line-length",
    "ktlint:standard:no-semi",
    "ktlint:standard:statement-wrapping",
    "MaxLineLength",
    "TooManyFunctions",
    "FunctionParameterNaming",
    "LongParameterList",
    "CyclomaticComplexMethod",
    "LongMethod",
)

package dev.kreuzberg

/**
 * Hierarchical level of an OCR element.
 *
 * Maps to Tesseract's page segmentation hierarchy and provides
 * equivalent semantics for PaddleOCR.
 */
enum class OcrElementLevel {
    /** Individual word */
    @com.fasterxml.jackson.annotation.JsonProperty("word")
    WORD,
    /** Line of text (default for PaddleOCR) */
    @com.fasterxml.jackson.annotation.JsonProperty("line")
    LINE,
    /** Paragraph or text block */
    @com.fasterxml.jackson.annotation.JsonProperty("block")
    BLOCK,
    /** Page-level element */
    @com.fasterxml.jackson.annotation.JsonProperty("page")
    PAGE;

    @com.fasterxml.jackson.annotation.JsonValue
    fun toWire(): String = when (this) {
        WORD -> "word"
        LINE -> "line"
        BLOCK -> "block"
        PAGE -> "page"
    }

    companion object {
        @com.fasterxml.jackson.annotation.JsonCreator
        @JvmStatic
        fun fromWire(value: String): OcrElementLevel = when (value) {
            "word" -> WORD
            "line" -> LINE
            "block" -> BLOCK
            "page" -> PAGE
            else -> throw IllegalArgumentException("Unknown OcrElementLevel value: $value")
        }
    }
}
