// 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;

/**
 * Bounding box in original image coordinates (x1, y1) top-left, (x2, y2) bottom-right.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BBox.Builder.class)
public record BBox(
    @JsonProperty("x1") float x1,
    @JsonProperty("y1") float y1,
    @JsonProperty("x2") float x2,
    @JsonProperty("y2") float y2
) {
    public static Builder builder() {
        return new Builder();
    }

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

private float x1 = 0.0f;
private float y1 = 0.0f;
private float x2 = 0.0f;
private float y2 = 0.0f;

        /** Sets the x1 field. */
        @JsonProperty("x1")
        public Builder withX1(final float value) {
            this.x1 = value;
            return this;
        }

        /** Sets the y1 field. */
        @JsonProperty("y1")
        public Builder withY1(final float value) {
            this.y1 = value;
            return this;
        }

        /** Sets the x2 field. */
        @JsonProperty("x2")
        public Builder withX2(final float value) {
            this.x2 = value;
            return this;
        }

        /** Sets the y2 field. */
        @JsonProperty("y2")
        public Builder withY2(final float value) {
            this.y2 = value;
            return this;
        }

        /** Builds the BBox instance. */
        public BBox build() {
            return new BBox(
                x1,
                y1,
                x2,
                y2
            );
        }
    }
    // CPD-ON
}
