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 = "templates", autoResultMap = true)
@Schema(description = "模板实体")
public class Template extends SimpleModel {
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "模板名称")
    @TableField("name")
    private String name;
    
    @Schema(description = "模板内容（带占位符）")
    @TableField("content")
    private String content;
    
    @Schema(description = "占位符映射", example = "{\"{{ds1}}\": \"dataSourceId1\"}")
    @TableField(value = "placeholder_mapping", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object placeholderMapping;
    
    @Schema(description = "复制来源模板ID")
    @TableField("source_template_id")
    private String sourceTemplateId;
    
    @Schema(description = "状态", example = "active/inactive")
    @TableField("status")
    private String status = "active";
    
    @Schema(description = "元数据")
    @TableField(value = "metadata", typeHandler = PostgreSqlJsonbTypeHandler.class)
    private Object metadata;
}
