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_relations", autoResultMap = true)
@Schema(description = "图关系实体")
public class GraphRelation extends SimpleModel {
    
    @Schema(description = "源节点ID")
    @TableField("from_node_id")
    private String fromNodeId;
    
    @Schema(description = "目标节点ID")
    @TableField("to_node_id")
    private String toNodeId;
    
    @Schema(description = "关系类型", example = "DEP/ADD/SUB/MUL/DIV/UNION/INTERSECT/AI")
    @TableField("relation_type")
    private String relationType;
    
    @Schema(description = "动作类型", example = "calculate/extract/generate")
    @TableField("action_type")
    private String actionType;
    
    @Schema(description = "动作配置", example = "{\"model_id\": \"qwen-7b\", \"prompt\": \"...\"}")
    @TableField(value = "action_config", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object actionConfig;
    
    @Schema(description = "顺序索引", example = "0")
    @TableField("order_index")
    private Integer orderIndex = 0;
    
    @Schema(description = "条件表达式", example = "value > 100")
    @TableField("condition_expr")
    private String conditionExpr;
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object metadata;
}
