// 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 java.util.List;
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;

/**
 * CSV/TSV file metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = CsvMetadata.Builder.class)
public record CsvMetadata(
    @JsonProperty("row_count") int rowCount,
    @JsonProperty("column_count") int columnCount,
    @Nullable @JsonProperty("delimiter") String delimiter,
    @JsonProperty("has_header") boolean hasHeader,
    @Nullable @JsonProperty("column_types") List<String> columnTypes
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("row_count")
private int rowCount = 0;
        @JsonProperty("column_count")
private int columnCount = 0;
private String delimiter = null;
        @JsonProperty("has_header")
private boolean hasHeader = false;
        @JsonProperty("column_types")
private List<String> columnTypes = null;

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

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

        /** Sets the delimiter field. */
        @JsonProperty("delimiter")
        public Builder withDelimiter(final @Nullable String value) {
            this.delimiter = value;
            return this;
        }

        /** Sets the hasHeader field. */
        @JsonProperty("has_header")
        public Builder withHasHeader(final boolean value) {
            this.hasHeader = value;
            return this;
        }

        /** Sets the columnTypes field. */
        @JsonProperty("column_types")
        public Builder withColumnTypes(final @Nullable List<String> value) {
            this.columnTypes = value;
            return this;
        }

        /** Builds the CsvMetadata instance. */
        public CsvMetadata build() {
            return new CsvMetadata(
                rowCount,
                columnCount,
                delimiter,
                hasHeader,
                columnTypes
            );
        }
    }
    // CPD-ON
}
