package com.infoepoch.pms.agent.platform.model.adapter.out.ai;

import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import com.infoepoch.pms.agent.platform.model.domain.AiModelConfig;
import com.infoepoch.pms.agent.platform.model.domain.AiModelProvider;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class DashScopeChatModelBuilderTest {

    @Test
    void shouldApplyThinkingAndMultiModelFlags() {
        AiModelProvider provider = new AiModelProvider(
                "DashScope",
                "DASHSCOPE",
                "https://dashscope.aliyuncs.com/compatible-mode/v1",
                "sk-test",
                null,
                "provider"
        );
        AiModelConfig config = new AiModelConfig(
                provider,
                "qwen-max",
                "LLM",
                "Qwen Max",
                2048,
                null,
                null,
                null,
                Boolean.TRUE,
                Boolean.FALSE,
                null
        );

        DashScopeChatModel model = (DashScopeChatModel) new DashScopeChatModelBuilder().build(config);
        DashScopeChatOptions options = (DashScopeChatOptions) model.getDefaultOptions();

        assertEquals("qwen-max", options.getModel());
        assertEquals(2048, options.getMaxTokens());
        assertTrue(options.getEnableThinking());
        assertFalse(options.getMultiModel());
    }
}
