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

/**
 * Hardware acceleration configuration for ONNX Runtime models.
 *
 * Controls which execution provider (CPU, CoreML, CUDA, TensorRT) is used
 * for inference in layout detection and embedding generation.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = AccelerationConfig.Builder.class)
public record AccelerationConfig(
    /**
     * Execution provider to use for ONNX inference.
     */
    @Nullable @JsonProperty("provider") ExecutionProviderType provider,
    /**
     * GPU device ID (for CUDA/TensorRT). Ignored for CPU/CoreML/Auto.
     */
    @Nullable @JsonProperty("device_id") Integer deviceId
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @Nullable private ExecutionProviderType provider = ExecutionProviderType.Auto;
        @JsonProperty("device_id")
private Integer deviceId = null;

        /** Sets the provider field. */
        @JsonProperty("provider")
        public Builder withProvider(final @Nullable ExecutionProviderType value) {
            this.provider = value;
            return this;
        }

        /** Sets the deviceId field. */
        @JsonProperty("device_id")
        public Builder withDeviceId(final @Nullable Integer value) {
            this.deviceId = value;
            return this;
        }

        /** Builds the AccelerationConfig instance. */
        public AccelerationConfig build() {
            return new AccelerationConfig(
                provider,
                deviceId
            );
        }
    }
    // CPD-ON
}
