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

/**
 * A resolved relationship between two nodes in the document tree.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = DocumentRelationship.Builder.class)
public record DocumentRelationship(
    /**
     * Source node index (the referencing node).
     */
    @JsonProperty("source") int source,
    /**
     * Target node index (the referenced node).
     */
    @JsonProperty("target") int target,
    /**
     * Semantic kind of the relationship.
     */
    @JsonProperty("kind") RelationshipKind kind
) {
    public static Builder builder() {
        return new Builder();
    }

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

private int source = 0;
private int target = 0;
private RelationshipKind kind = null;

        /** Sets the source field. */
        @JsonProperty("source")
        public Builder withSource(final int value) {
            this.source = value;
            return this;
        }

        /** Sets the target field. */
        @JsonProperty("target")
        public Builder withTarget(final int value) {
            this.target = value;
            return this;
        }

        /** Sets the kind field. */
        @JsonProperty("kind")
        public Builder withKind(final RelationshipKind value) {
            this.kind = value;
            return this;
        }

        /** Builds the DocumentRelationship instance. */
        public DocumentRelationship build() {
            return new DocumentRelationship(
                source,
                target,
                kind
            );
        }
    }
    // CPD-ON
}
