package com.correx.testing.fixtures.tools

import com.correx.core.approvals.Tier
import com.correx.core.events.events.ToolRequest
import com.correx.core.events.types.SessionId
import com.correx.core.events.types.StageId
import com.correx.core.events.types.ToolInvocationId
import com.correx.core.tools.contract.ValidationResult
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertInstanceOf

class MockToolsTest {

    private val request = ToolRequest(
        invocationId = ToolInvocationId("inv-1"),
        sessionId = SessionId("s-1"),
        stageId = StageId("st-1"),
        toolName = "test"
    )

    @Test
    fun `EchoTool is T0 and validates any request as Valid`() {
        val tool = EchoTool()
        assertEquals(Tier.T0, tool.tier)
        assertInstanceOf<ValidationResult.Valid>(tool.validateRequest(request))
    }

    @Test
    fun `FailingTool is T2 and validates any request as Invalid`() {
        val tool = FailingTool()
        assertEquals(Tier.T2, tool.tier)
        assertInstanceOf<ValidationResult.Invalid>(tool.validateRequest(request))
    }

    @Test
    fun `RejectedTool is T4 and validates any request as Valid`() {
        val tool = RejectedTool()
        assertEquals(Tier.T4, tool.tier)
        assertInstanceOf<ValidationResult.Valid>(tool.validateRequest(request))
    }
}
