package com.microservices.file.domain.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 分片检查返回VO
 *
 * @author microservices
 */
@Data
@ApiModel("分片检查返回")
public class CheckChunkVo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 分片是否存在
     */
    @ApiModelProperty(value = "分片是否存在")
    private Boolean exists;

    /**
     * 分片序号
     */
    @ApiModelProperty(value = "分片序号")
    private Integer chunkNumber;

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

    public static CheckChunkVo exists(Integer chunkNumber, Long chunkSize) {
        CheckChunkVo vo = new CheckChunkVo();
        vo.setExists(true);
        vo.setChunkNumber(chunkNumber);
        vo.setChunkSize(chunkSize);
        return vo;
    }

    public static CheckChunkVo notExists(Integer chunkNumber) {
        CheckChunkVo vo = new CheckChunkVo();
        vo.setExists(false);
        vo.setChunkNumber(chunkNumber);
        return vo;
    }
}
