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 = "data_sources", autoResultMap = true)
@Schema(description = "数据源实体")
public class DataSource extends SimpleModel {
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "文档ID")
    @TableField("document_id")
    private String documentId;
    
    @Schema(description = "数据源名称")
    @TableField("name")
    private String name;
    
    @Schema(description = "数据源类型", example = "table/text/image")
    @TableField("type")
    private String type;
    
    @Schema(description = "来源类型", example = "file/manual/rule_result")
    @TableField("source_type")
    private String sourceType;
    
    @Schema(description = "关联的节点ID数组")
    @TableField(value = "node_ids", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object nodeIds;
    
    @Schema(description = "数据源配置")
    @TableField(value = "config", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object config;
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object metadata;
}
