// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package io.gitea.sdk.models;

import java.util.function.Consumer;

/**
 * Options for chunked uploads.
 */
public class ChunkedUploadOptions {
    private long chunkSize = 10 * 1024 * 1024; // 10MB default
    private int parallel = 4;
    private boolean verifyChecksum = true;
    private Consumer<Progress> onProgress;

    public ChunkedUploadOptions() {
    }

    /**
     * Size of each chunk in bytes (default: 10MB).
     */
    public long getChunkSize() {
        return chunkSize;
    }

    public ChunkedUploadOptions setChunkSize(long chunkSize) {
        this.chunkSize = chunkSize;
        return this;
    }

    /**
     * Number of parallel upload workers (default: 4).
     */
    public int getParallel() {
        return parallel;
    }

    public ChunkedUploadOptions setParallel(int parallel) {
        this.parallel = parallel;
        return this;
    }

    /**
     * Whether to verify file checksum (default: true).
     */
    public boolean isVerifyChecksum() {
        return verifyChecksum;
    }

    public ChunkedUploadOptions setVerifyChecksum(boolean verifyChecksum) {
        this.verifyChecksum = verifyChecksum;
        return this;
    }

    /**
     * Progress callback.
     */
    public Consumer<Progress> getOnProgress() {
        return onProgress;
    }

    public ChunkedUploadOptions setOnProgress(Consumer<Progress> onProgress) {
        this.onProgress = onProgress;
        return this;
    }

    /**
     * Creates options with default settings.
     */
    public static ChunkedUploadOptions defaults() {
        return new ChunkedUploadOptions();
    }

    /**
     * Creates options with specified chunk size.
     */
    public static ChunkedUploadOptions withChunkSize(long chunkSize) {
        return new ChunkedUploadOptions().setChunkSize(chunkSize);
    }
}
