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

/**
 * dBASE (DBF) file metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = DbfMetadata.Builder.class)
public record DbfMetadata(
    @JsonProperty("record_count") long recordCount,
    @JsonProperty("field_count") long fieldCount,
    @Nullable @JsonProperty("fields") List<DbfFieldInfo> fields
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("record_count")
private long recordCount = 0;
        @JsonProperty("field_count")
private long fieldCount = 0;
private List<DbfFieldInfo> fields = null;

        /** Sets the recordCount field. */
        @JsonProperty("record_count")
        public Builder withRecordCount(final long value) {
            this.recordCount = value;
            return this;
        }

        /** Sets the fieldCount field. */
        @JsonProperty("field_count")
        public Builder withFieldCount(final long value) {
            this.fieldCount = value;
            return this;
        }

        /** Sets the fields field. */
        @JsonProperty("fields")
        public Builder withFields(final @Nullable List<DbfFieldInfo> value) {
            this.fields = value;
            return this;
        }

        /** Builds the DbfMetadata instance. */
        public DbfMetadata build() {
            return new DbfMetadata(
                recordCount,
                fieldCount,
                fields
            );
        }
    }
    // CPD-ON
}
