package org.springblade.file.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * <p>
 * 业务解压任务表
 * </p>
 *
 * @author bfhuange
 * @since 2024-10-28
 */
@Data
@TableName("blade_business_unzip_task")
@Schema(description = "业务解压任务表")
public class BusinessUnzipTask implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "主键")
    private Long id;

    @Schema(description = "业务id")
    private Long bizId;
    /**
     * 部门名称ID
     */
    @Schema(description = "部门名称ID")
    private Long departmentId;

    @Schema(description = "业务code")
    private String bizCode;

    @Schema(description = "文档编号")
    private String docCode;

    @Schema(description = "关联类型，file_task 文件任务，attachment 附件")
    private String relateType;

    @Schema(description = "关联id，文件任务id或附件id")
    private Long relateId;

    @Schema(description = "状态 uploading：正在上传  unzipping：解压中 finished：已完成")
    private String status;

    @Schema(description = "租户ID")
    @TableField(fill = FieldFill.INSERT)
    private String tenantId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "创建人", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @Schema(description = "创建时间", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "更新人", hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @Schema(description = "更新时间", hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Schema(description = "是否已删除", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    private Integer isDeleted;
}
