package com.lingyue.document.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lingyue.common.domain.entity.SimpleModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 文档实体
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("documents")
@Schema(description = "文档实体")
public class Document extends SimpleModel {
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "文档名称")
    @TableField("name")
    private String name;
    
    @Schema(description = "文档类型")
    @TableField("type")
    private String type; // pdf/word/image/markdown/other
    
    @Schema(description = "状态")
    @TableField("status")
    private String status = "pending"; // pending/uploading/parsing/completed/failed
    
    @Schema(description = "文件大小")
    @TableField("file_size")
    private Long fileSize;
    
    @Schema(description = "文件URL")
    @TableField("file_url")
    private String fileUrl;
    
    @Schema(description = "缩略图URL")
    @TableField("thumbnail_url")
    private String thumbnailUrl;
    
    @Schema(description = "解析后的文本")
    @TableField("parsed_text")
    private String parsedText;
    
    @Schema(description = "解析状态")
    @TableField("parse_status")
    private String parseStatus; // pending/parsing/completed/failed
    
    @Schema(description = "解析进度")
    @TableField("parse_progress")
    private Integer parseProgress = 0; // 0-100
    
    @Schema(description = "解析错误")
    @TableField("parse_error")
    private String parseError;
    
    @Schema(description = "解析开始时间")
    @TableField("parse_started_at")
    private Date parseStartedAt;
    
    @Schema(description = "解析完成时间")
    @TableField("parse_completed_at")
    private Date parseCompletedAt;
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private Object metadata;
}
