package com.bonus.common.entity.file;

import cn.hutool.core.bean.BeanUtil;
import com.bonus.common.entity.file.model.MongoFile;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author lit@epsoft.com.cn
 * @version 1.0
 * @Description 统一文件下载vo
 * @date Apr 8, 2022
 */
@Data
public class FileExportVo implements Serializable {

    private String file;

    private String fileId;

    private String fileName;

    private String contentType;

    private String suffix;

    private long fileSize;

    private String sourceId;

    private String id;

    private String fileType;
    /**
     * 资源类型
     */
    private String sourceType;

    private String updaetTime;

    @JsonIgnore
    private byte[] data;

    public FileExportVo() {
    }



    public FileExportVo(MongoFile mongoFile) {
        BeanUtil.copyProperties(mongoFile, this);
        if (Objects.nonNull(mongoFile.getContent())) {
            this.data = mongoFile.getContent().getData();
        }
        this.fileId = mongoFile.getId();
    }

}
