package com.bonus.canteen.core.common.export.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil;
import com.bonus.canteen.core.common.export.model.ExportRecord;
import com.bonus.canteen.core.common.utils.SysUtil;

import java.time.LocalDateTime;

public class ExportRecordVO {
   private Long exportId;
   private String fileName;
   private String fileUrl;
   private Long fileSize;
   private Integer exportFileState;
   private Integer exportFileType;
   private Integer process;
   private Integer ifPrivate;
   private LocalDateTime crtime;
   private LocalDateTime expiredTime;
   private LocalDateTime finishTime;

   public String getFileUrl() {
      return SysUtil.getCutFileUrl(this.fileUrl);
   }

   public String getFileSizeStr() {
      return FileUtil.readableFileSize(this.fileSize);
   }

   public static ExportRecordVO of(ExportRecord exportRecord) {
      return (ExportRecordVO)BeanUtil.copyProperties(exportRecord, ExportRecordVO.class, new String[0]);
   }

   public Long getExportId() {
      return this.exportId;
   }

   public String getFileName() {
      return this.fileName;
   }

   public Long getFileSize() {
      return this.fileSize;
   }

   public Integer getExportFileState() {
      return this.exportFileState;
   }

   public Integer getExportFileType() {
      return this.exportFileType;
   }

   public Integer getProcess() {
      return this.process;
   }

   public Integer getIfPrivate() {
      return this.ifPrivate;
   }

   public LocalDateTime getCrtime() {
      return this.crtime;
   }

   public LocalDateTime getExpiredTime() {
      return this.expiredTime;
   }

   public LocalDateTime getFinishTime() {
      return this.finishTime;
   }

   public void setExportId(final Long exportId) {
      this.exportId = exportId;
   }

   public void setFileName(final String fileName) {
      this.fileName = fileName;
   }

   public void setFileUrl(final String fileUrl) {
      this.fileUrl = fileUrl;
   }

   public void setFileSize(final Long fileSize) {
      this.fileSize = fileSize;
   }

   public void setExportFileState(final Integer exportFileState) {
      this.exportFileState = exportFileState;
   }

   public void setExportFileType(final Integer exportFileType) {
      this.exportFileType = exportFileType;
   }

   public void setProcess(final Integer process) {
      this.process = process;
   }

   public void setIfPrivate(final Integer ifPrivate) {
      this.ifPrivate = ifPrivate;
   }

   public void setCrtime(final LocalDateTime crtime) {
      this.crtime = crtime;
   }

   public void setExpiredTime(final LocalDateTime expiredTime) {
      this.expiredTime = expiredTime;
   }

   public void setFinishTime(final LocalDateTime finishTime) {
      this.finishTime = finishTime;
   }

}
