package com.correx.testing.contracts.model.orchestration

import com.correx.core.events.execution.RetryPolicy
import com.correx.core.kernel.execution.ReplayStrategy
import com.correx.core.kernel.orchestration.OrchestrationConfig
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class OrchestrationConfigTest {

    @Test
    fun `default retryPolicy has maxAttempts of 3`() {
        assertEquals(3, OrchestrationConfig().retryPolicy.maxAttempts)
    }

    @Test
    fun `default replayStrategy is Full`() {
        assertEquals(ReplayStrategy.Full, OrchestrationConfig().replayStrategy)
    }

    @Test
    fun `default stageTimeoutMs is 60 seconds`() {
        assertEquals(60_000L, OrchestrationConfig().stageTimeoutMs)
    }

    @Test
    fun `custom values are stored`() {
        val config = OrchestrationConfig(
            retryPolicy = RetryPolicy(maxAttempts = 5, backoffMs = 200L),
            replayStrategy = ReplayStrategy.Full,
            stageTimeoutMs = 30_000L,
        )
        assertEquals(5, config.retryPolicy.maxAttempts)
        assertEquals(200L, config.retryPolicy.backoffMs)
        assertEquals(30_000L, config.stageTimeoutMs)
    }
}
