// 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
package dev.kreuzberg;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * The 17 canonical document layout classes.
 *
 * All model backends (RT-DETR, YOLO, etc.) map their native class IDs
 * to this shared set. Models with fewer classes (DocLayNet: 11, PubLayNet: 5)
 * map to the closest equivalent.
 *
 * Wire format is snake_case in all serializers (JSON, TOML, YAML).
 */
public enum LayoutClass {
    Caption("caption"),
    Footnote("footnote"),
    Formula("formula"),
    ListItem("list_item"),
    PageFooter("page_footer"),
    PageHeader("page_header"),
    Picture("picture"),
    SectionHeader("section_header"),
    Table("table"),
    Text("text"),
    Title("title"),
    DocumentIndex("document_index"),
    Code("code"),
    CheckboxSelected("checkbox_selected"),
    CheckboxUnselected("checkbox_unselected"),
    Form("form"),
    KeyValueRegion("key_value_region");

    /** The string value. */
    private final String value;

    LayoutClass(final String value) {
        this.value = value;
    }

    /** Returns the string value. */
    @JsonValue
    public String getValue() {
        return value;
    }

    /** Creates an instance from a string value. */
    @JsonCreator
    public static LayoutClass fromValue(final String value) {
        for (LayoutClass e : values()) {
            if (e.value.equalsIgnoreCase(value)) {
                return e;
            }
        }
        throw new IllegalArgumentException("Unknown value: " + value);
    }

    /** Returns the wire-format string value (matches JSON serialization). */
    @Override
    public String toString() {
        return value;
    }
}
