// 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.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.jspecify.annotations.Nullable;

/**
 * Rotation information for an OCR element.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = OcrRotation.Builder.class)
public record OcrRotation(
    /**
     * Rotation angle in degrees (0, 90, 180, 270 for PaddleOCR).
     */
    @JsonProperty("angle_degrees") double angleDegrees,
    /**
     * Confidence score for the rotation detection.
     */
    @Nullable @JsonProperty("confidence") Double confidence
) {
    public static Builder builder() {
        return new Builder();
    }

    // CPD-OFF
    @JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
    public static final class Builder {

        @JsonProperty("angle_degrees")
private double angleDegrees = 0.0;
private Double confidence = null;

        /** Sets the angleDegrees field. */
        @JsonProperty("angle_degrees")
        public Builder withAngleDegrees(final double value) {
            this.angleDegrees = value;
            return this;
        }

        /** Sets the confidence field. */
        @JsonProperty("confidence")
        public Builder withConfidence(final @Nullable double value) {
            this.confidence = value;
            return this;
        }

        /** Builds the OcrRotation instance. */
        public OcrRotation build() {
            return new OcrRotation(
                angleDegrees,
                confidence
            );
        }
    }
    // CPD-ON
}
