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.Serializable;
import java.util.Date;

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

@Data
@TableName("blade_attachment")
@Schema(description = "附件对象")
public class Attachment implements Serializable {

    private static final long serialVersionUID = 1L;

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

    /**
     * 附件名
     */
    @Schema(description = "附件名")
    private String attachmentName;

    /**
     * 压缩文件所在压缩包相对路径
     */
    @Schema(description = "压缩文件所在压缩包相对路径")
    private String dir;

    /**
     * 附件大小(单位:B)
     */
    @Schema(description = "附件大小(单位:B)")
    private Long size;

    /**
     * objectKey
     */
    @Schema(description = "华为OBS objectKey")
    private String objectKey;

    /**
     * 创建人-用户名称
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "创建人-用户名称")
    @TableField(fill = FieldFill.INSERT)
    private String createUserName;

    /**
     * 创建人
     */
    @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;

    /**
     * 更新人-用户名称
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "创建人-用户名称")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateUserName;

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

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

    /**
     * 状态[0:未删除,1:删除]
     */
    @TableLogic
    @Schema(description = "是否已删除 [0:未删除,1:删除]")
    private Integer isDeleted;

}
