package com.sonic.cow.tools;

import com.google.common.collect.Lists;
import com.sonic.cow.client.request.Tools;

import java.util.HashMap;
import java.util.Map;

/**
 * 函数定义
 */
public class ToolsDefinition {

    public static Tools getAiImageToolsV2(String functionName, String functionDescription) {
        // 步骤 1: 定义工具
        Map<String, Object> userIdProperty = new HashMap<>();
        userIdProperty.put("type", "long");
        userIdProperty.put("description", "userId");

        Map<String, Object> aiIdProperty = new HashMap<>();
        aiIdProperty.put("type", "long");
        aiIdProperty.put("description", "aiId");

        Map<String, Object> schemaProperties = new HashMap<>();
        schemaProperties.put("userId", userIdProperty);
        schemaProperties.put("aiId", aiIdProperty);

        FunctionParameterSchema functionParams = new FunctionParameterSchema(
                "object",
                schemaProperties,
                Lists.newArrayList("userId", "aiId") // 'userId'、'aiId' 是必需参数
        );
        return Tools.builder()
                .type("function")
                .name(functionName)
                .parameters(functionParams.toString())
                .description(functionDescription)
                .build();
    }

}
