package de.assecutor.votianlt.mcp.config;

import de.assecutor.votianlt.mcp.tools.JobQueryTool;
import de.assecutor.votianlt.mcp.tools.JobStatisticsTool;
import de.assecutor.votianlt.mcp.tools.TaskCompletionTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Configuration for the MCP (Model Context Protocol) server. Registers all MCP
 * tools for job statistics and queries.
 */
@Configuration
@Slf4j
public class McpServerConfig {

    @Bean
    public ToolCallbackProvider jobStatisticsToolProvider(JobStatisticsTool jobStatisticsTool) {
        log.info("Registering JobStatisticsTool for MCP server");
        return MethodToolCallbackProvider.builder().toolObjects(jobStatisticsTool).build();
    }

    @Bean
    public ToolCallbackProvider jobQueryToolProvider(JobQueryTool jobQueryTool) {
        log.info("Registering JobQueryTool for MCP server");
        return MethodToolCallbackProvider.builder().toolObjects(jobQueryTool).build();
    }

    @Bean
    public ToolCallbackProvider taskCompletionToolProvider(TaskCompletionTool taskCompletionTool) {
        log.info("Registering TaskCompletionTool for MCP server");
        return MethodToolCallbackProvider.builder().toolObjects(taskCompletionTool).build();
    }
}
