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;

/**
 * @author zhaowei
 * @date 2024/8/16
 */

@Data
@TableName("blade_file_task_part")
@Schema(description = "文件任务分段表")
public class FileTaskPart implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

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

    /**
     *  文件任务Id
     */
    @Schema(description = "文件任务Id")
    private Long fileTaskId;

    /**
     *  段号。分段号可以是不连续的。取值范围是[1,10000]的非负整数
     */
    @Schema(description = "段号。分段号可以是不连续的。取值范围是[1,10000]的非负整数")
    private Integer partNumber;

    /**
     *  段的ETag值。分段的Base64编码的128位MD5摘要，长度为32的字符串
     */
    @Schema(description = "段的ETag值。分段的Base64编码的128位MD5摘要，长度为32的字符串")
    private String etag;

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

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

}
