package com.gzzm.lobster.tool.mcp;

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

import java.util.List;

public abstract class McpServerConfigDao extends GeneralDao {

    @OQL("select s from McpServerConfig s where s.serverId=:1")
    public abstract McpServerConfig getConfig(String serverId) throws Exception;

    @OQL("select s from McpServerConfig s where s.enabled=1")
    public abstract List<McpServerConfig> listEnabled() throws Exception;

    @OQL("select s from McpServerConfig s order by s.namespace asc, s.serverId asc limit :1,:2")
    public abstract List<McpServerConfig> listAll(int offset, int limit) throws Exception;

    @OQL("select count(s) from McpServerConfig s")
    public abstract long countAll() throws Exception;

    @OQLUpdate("delete from McpServerConfig where serverId=?1")
    public abstract int deleteById(String serverId) throws Exception;
}
