package com.cfdeployer.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChunkUploadResponse {

    private Boolean success;
    private String uploadSessionId;
    private String fileType;
    private Integer chunkIndex;
    private Integer totalChunks;
    private Integer receivedChunks;
    private String message;

    public static ChunkUploadResponse success(String uploadSessionId, String fileType,
                                             Integer chunkIndex, Integer totalChunks, Integer receivedChunks) {
        return ChunkUploadResponse.builder()
                .success(true)
                .uploadSessionId(uploadSessionId)
                .fileType(fileType)
                .chunkIndex(chunkIndex)
                .totalChunks(totalChunks)
                .receivedChunks(receivedChunks)
                .message("Chunk uploaded successfully")
                .build();
    }

    public static ChunkUploadResponse failure(String message) {
        return ChunkUploadResponse.builder()
                .success(false)
                .message(message)
                .build();
    }
}
