package com.gzzm.lobster.prompt;

import com.gzzm.lobster.common.PromptScope;
import net.cyan.thunwind.annotation.ColumnDescription;
import net.cyan.thunwind.annotation.Entity;
import net.cyan.thunwind.annotation.Index;

import java.util.Date;

/**
 * PromptTemplate —— system prompt 模板 / DB-managed system prompt template.
 *
 * <p>§1–§4（角色、行为纪律、工具规则、输出格式）必须稳定，字节级一致，
 * 以命中 Prompt Cache。§5（动态规则）按轮次注入。
 *
 * <p>§1–§4 must be byte-identical per run to enable prompt cache hits.
 * §5 is dynamic per turn.
 */
@Entity(table = "AI_PROMPT_TEMPLATE", keys = "templateId")
public class PromptTemplate {

    @ColumnDescription(type = "varchar(60)")
    private String templateId;

    @Index
    @ColumnDescription(type = "varchar(100)", nullable = false)
    private String templateName;

    @ColumnDescription(type = "number(6)", nullable = false, defaultValue = "1")
    private Integer version;

    @ColumnDescription(type = "blob", nullable = false)
    private String content;

    private PromptScope scope;

    @ColumnDescription(type = "varchar(40)")
    private String orgId;

    @ColumnDescription(type = "varchar(40)")
    private String agentId;

    @ColumnDescription(type = "number(1)", defaultValue = "1")
    private Boolean active;

    private Date createTime;
    private Date updateTime;

    public PromptTemplate() {}

    public String getTemplateId() { return templateId; }
    public void setTemplateId(String templateId) { this.templateId = templateId; }
    public String getTemplateName() { return templateName; }
    public void setTemplateName(String templateName) { this.templateName = templateName; }
    public Integer getVersion() { return version; }
    public void setVersion(Integer version) { this.version = version; }
    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }
    public PromptScope getScope() { return scope; }
    public void setScope(PromptScope scope) { this.scope = scope; }
    public String getOrgId() { return orgId; }
    public void setOrgId(String orgId) { this.orgId = orgId; }
    public String getAgentId() { return agentId; }
    public void setAgentId(String agentId) { this.agentId = agentId; }
    public Boolean getActive() { return active; }
    public void setActive(Boolean active) { this.active = active; }
    public Date getCreateTime() { return createTime; }
    public void setCreateTime(Date createTime) { this.createTime = createTime; }
    public Date getUpdateTime() { return updateTime; }
    public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
}
