using MediatR;

namespace StorageService.API.Application.Commands.MultipartUpload;

/// <summary>
/// EN: Command to upload a single part of a multipart upload.
/// VI: Command để upload một part của multipart upload.
/// </summary>
public record UploadPartCommand(
    Guid UploadId,
    int PartNumber,
    Stream DataStream,
    string UserId
) : IRequest<UploadPartResult>;

/// <summary>
/// EN: Result of part upload.
/// VI: Kết quả upload part.
/// </summary>
public record UploadPartResult(
    bool Success,
    string? ETag,
    string? Error
)
{
    public static UploadPartResult Ok(string etag) => new(true, etag, null);
    public static UploadPartResult Fail(string error) => new(false, null, error);
}
