package com.gzzm.lobster.prompt;

import net.cyan.thunwind.annotation.OQL;
import net.cyan.thunwind.dao.GeneralDao;

import java.util.List;

/**
 * PromptTemplateDao —— Prompt 模板持久化 / Prompt template persistence.
 */
public abstract class PromptTemplateDao extends GeneralDao {

    @OQL("select t from PromptTemplate t where t.templateId=:1")
    public abstract PromptTemplate getTemplate(String templateId) throws Exception;

    @OQL("select t from PromptTemplate t where t.active=1 and t.templateName=?1 order by t.version desc limit 0,1")
    public abstract PromptTemplate getActiveByName(String templateName) throws Exception;

    @OQL("select t from PromptTemplate t where t.templateName=?1 order by t.version desc")
    public abstract List<PromptTemplate> listVersions(String templateName) throws Exception;
}
