package com.backendsys.modules.upload.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 jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
@TableName("sys_file")
public class SysFile {

    public static interface Update{}
    public static interface Delete{}
    public static interface DeleteBatch{}

    @TableId(type = IdType.AUTO)
    @NotNull(message = "id 不能为空", groups = { Update.class })
    private Long id;

    private Long category_id;

    @TableField(exist = false)
    private String category_name;
    private String request_id;

    private String upload_id;
    private Integer upload_chunk_count;
    private Integer upload_chunk_index;

    private Long user_id;

    @NotEmpty(message = "文件名不能为空", groups = { Update.class })
    @Size(max = 100, message = "资讯分类名称长度不超过 {max} 字符", groups = { Update.class })
    private String name;
    private String content_type;
    private String url;
    private String url_thumb;

    @NotEmpty(message = "object_key 不能为空", groups = { Delete.class })
    private String object_key;
    @TableField(exist = false)
    @NotNull(message = "object_keys 不能为空", groups = { DeleteBatch.class })
    private String object_keys;

    private Long size;
    private String md5;
    private Integer target;         // 上传目标 (-1:本地, 1:腾讯云, 2:阿里云, 3.抖音云)
    private String create_time;
    private String update_time;
}
