package com.lingyue.graph.entity;

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

/**
 * 图节点实体
 * 用于存储文档中提取的各类实体节点
 * 
 * @author lingyue
 * @since 2026-01-14
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "graph_nodes", autoResultMap = true)
@Schema(description = "图节点实体")
public class GraphNode extends SimpleModel {
    
    @Schema(description = "文档ID")
    @TableField("document_id")
    private String documentId;
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "节点名称")
    @TableField("name")
    private String name;
    
    @Schema(description = "节点类型", example = "text/table/image/number/date/company/person/device")
    @TableField("type")
    private String type;
    
    @Schema(description = "节点值")
    @TableField("value")
    private String value;
    
    @Schema(description = "位置信息", example = "{\"file_id\": \"xxx\", \"page\": 1, \"line\": 5}")
    @TableField(value = "position", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object position;
    
    @Schema(description = "父节点ID")
    @TableField("parent_id")
    private String parentId;
    
    @Schema(description = "层级", example = "0")
    @TableField("level")
    private Integer level = 0;
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object metadata;
}
