package cn.meowrain.aioj.backend.fileservice.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 通用附件表
 * </p>
 *
 * @author meowrain
 * @since 2026-01-10
 */
@Getter
@Setter
@ToString
@TableName("attachment")
public class AttachmentDO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 原始文件名
     */
    @TableField("file_name")
    private String fileName;

    /**
     * 文件后缀名
     */
    @TableField("file_extension")
    private String fileExtension;

    /**
     * 文件大小(Byte)
     */
    @TableField("file_size")
    private Long fileSize;

    /**
     * 文件哈希(MD5/SHA256)用于去重
     */
    @TableField("file_hash")
    private String fileHash;

    /**
     * MIME类型
     */
    @TableField("mime_type")
    private String mimeType;

    /**
     * 存储方案: LOCAL, OSS, S3, MINIO
     */
    @TableField("storage_type")
    private String storageType;

    /**
     * 物理存储路径或对象存储Key
     */
    @TableField("storage_path")
    private String storagePath;

    /**
     * 所属业务模块
     */
    @TableField("business_type")
    private String businessType;

    /**
     * 所属业务id
     */
    @TableField("business_id")
    private Long businessId;

    /**
     * 上传者ID
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 图片宽高、EXIF等元数据
     */
    @TableField("image_info")
    private String imageInfo;

    /**
     * 逻辑删除(0-正常, 1-已删除)
     */
    @TableField("is_deleted")
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @TableField("created_at")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField("updated_at")
    private LocalDateTime updatedAt;
}
