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

/**
 * Archive (ZIP/TAR/7Z) metadata.
 *
 * Extracted from compressed archive files containing file lists and size information.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ArchiveMetadata.Builder.class)
public record ArchiveMetadata(
    /**
     * Archive format ("ZIP", "TAR", "7Z", etc.)
     */
    @JsonProperty("format") String format,
    /**
     * Total number of files in the archive
     */
    @JsonProperty("file_count") int fileCount,
    /**
     * List of file paths within the archive
     */
    @JsonProperty("file_list") List<String> fileList,
    /**
     * Total uncompressed size in bytes
     */
    @JsonProperty("total_size") long totalSize,
    /**
     * Compressed size in bytes (if available)
     */
    @Nullable @JsonProperty("compressed_size") Long compressedSize
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String format = "";
        @JsonProperty("file_count")
private int fileCount = 0;
        @JsonProperty("file_list")
private List<String> fileList = List.of();
        @JsonProperty("total_size")
private long totalSize = 0;
        @JsonProperty("compressed_size")
private Long compressedSize = null;

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

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

        /** Sets the fileList field. */
        @JsonProperty("file_list")
        public Builder withFileList(final List<String> value) {
            this.fileList = value;
            return this;
        }

        /** Sets the totalSize field. */
        @JsonProperty("total_size")
        public Builder withTotalSize(final long value) {
            this.totalSize = value;
            return this;
        }

        /** Sets the compressedSize field. */
        @JsonProperty("compressed_size")
        public Builder withCompressedSize(final @Nullable long value) {
            this.compressedSize = value;
            return this;
        }

        /** Builds the ArchiveMetadata instance. */
        public ArchiveMetadata build() {
            return new ArchiveMetadata(
                format,
                fileCount,
                fileList,
                totalSize,
                compressedSize
            );
        }
    }
    // CPD-ON
}
