namespace Health.Infrastructure.AI.AgentHandlers;

/// <summary>
/// 拍饮食 Agent 工具处理器——食物估算
/// </summary>
public static class DietAgentHandler
{
    public static readonly ToolDefinition EstimateFoodTool = new()
    {
        Function = new() { Name = "estimate_food_text", Description = "根据文字描述估算食物份量和热量", Parameters = new { type = "object", properties = new { text = new { type = "string" } }, required = new[] { "text" } } }
    };

    public static List<ToolDefinition> Tools => [EstimateFoodTool, CommonAgentHandler.CheckArchiveTool];

    public static Task<object> Execute(string toolName, JsonElement args, AppDbContext db, Guid userId)
    {
        return toolName switch
        {
            "check_archive" => CommonAgentHandler.Execute(toolName, args, db, userId),
            _ => Task.FromResult<object>(new { success = false, message = $"未知工具: {toolName}" })
        };
    }
}
