package com.microservices.file.domain.vo.response;

import com.microservices.file.domain.vo.CheckChunkVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 检查分片响应
 *
 * @author microservices
 */
@Data
@ApiModel("检查分片响应")
public class CheckChunkResponseVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("分片是否存在")
    private Boolean exists;

    @ApiModelProperty("分片序号")
    private Integer chunkNumber;

    @ApiModelProperty("分片大小（字节）")
    private Long chunkSize;

    /**
     * 从CheckChunkVo转换
     */
    public static CheckChunkResponseVo from(CheckChunkVo vo) {
        CheckChunkResponseVo response = new CheckChunkResponseVo();
        response.setExists(vo.getExists());
        response.setChunkNumber(vo.getChunkNumber());
        response.setChunkSize(vo.getChunkSize());
        return response;
    }
}
