
package org.sky.scientific.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.sky.core.tenant.mp.TenantEntity;
import org.sky.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.util.Date;

/**
 * 下载任务表 实体类
 *
 * @author Kd
 * @since 2025-06-29
 */
@Data
@TableName("kd_download_task")
@Schema(description = "Asset对象")
@EqualsAndHashCode(callSuper = true)
public class DownloadTask extends TenantEntity {

	@Serial
	private static final long serialVersionUID = 1L;

	@Schema(description = "年份")
	@NotBlank(message = "参数yearAndMonth不能为空")
	@Size(min = 4, max = 4, message = "参数yearAndMonth格式错误，YYYY")
	private String yearAndMonth;

	@Schema(description = "完成时间")
	@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
	@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
	private Date doneTime;

	@Schema(description = "过期时间")
	@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
	@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
	private Date expireTime;

	@Schema(description = "状态，0：进行中，2：已完成，4：已超时/已删除")
	private Integer status;

	@Schema(description = "压缩文件的路径")
	@JsonIgnore
	private String zipUrl;

	@Schema(description = "压缩文件大小")
	private Long fileSize;

	@Schema(description = "类型，0：一键下载，1：一键导出高新被查，2：一键导出加计被查")
	@NotNull(message = "参数type不能为空")
	private Integer type;

	@Schema(description = "下载任务是否已删除")
	@TableField(exist = false)
	private Integer deleted;
}
