package com.lingyue.ai.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.math.BigDecimal;

/**
 * 要素实体
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("elements")
@Schema(description = "要素实体")
public class Element extends SimpleModel {
    
    @Schema(description = "文档ID")
    @TableField("document_id")
    private String documentId;
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "类型")
    @TableField("type")
    private String type; // amount/company/person/location/date/other
    
    @Schema(description = "标签")
    @TableField("label")
    private String label;
    
    @Schema(description = "值")
    @TableField("value")
    private String value;
    
    @Schema(description = "位置")
    @TableField(value = "position", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private Object position; // {page, x, y, width, height}
    
    @Schema(description = "置信度")
    @TableField("confidence")
    private BigDecimal confidence; // 0.00-1.00
    
    @Schema(description = "提取方法")
    @TableField("extraction_method")
    private String extractionMethod; // ai/regex/rule/manual
    
    @Schema(description = "图节点ID")
    @TableField("graph_node_id")
    private String graphNodeId;
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private Object metadata;
}
