package com.correx.infrastructure.tools.task

import com.correx.core.tasks.TaskArtifactResolver
import com.correx.core.tasks.TaskContextAssembler
import com.correx.core.tasks.TaskDocumentResolver
import com.correx.core.tasks.TaskKnowledgeRetriever
import com.correx.core.tasks.TaskService
import com.correx.core.tasks.TaskSessionResolver
import com.correx.core.tools.contract.Tool

/** Builds the task tool set over a single [TaskService] for registration in the tool registry. */
object TaskTools {
    /**
     * [retriever] semantically enriches the `task_context` bundle; [documentResolver],
     * [artifactResolver] and [sessionResolver] inline DOC/ARTIFACT/SESSION link targets. All
     * optional — null leaves those links raw and the bundle deterministic.
     */
    fun forService(
        service: TaskService,
        retriever: TaskKnowledgeRetriever? = null,
        documentResolver: TaskDocumentResolver? = null,
        artifactResolver: TaskArtifactResolver? = null,
        sessionResolver: TaskSessionResolver? = null,
        sessionFacts: SessionFactRecorder? = null,
        sessionWrites: SessionWrites? = null,
    ): List<Tool> =
        listOf(
            TaskCreateTool(service),
            TaskDecomposeTool(service),
            TaskUpdateTool(service, sessionFacts, sessionWrites),
            ProposeScopeTool(service),
            TaskDeleteTool(service),
            TaskSearchTool(service),
            TaskReadyTool(service),
            TaskContextTool(
                TaskContextAssembler(service, retriever, documentResolver, artifactResolver, sessionResolver),
            ),
        )
}
