package dev.sonpx.loyalty.agent.core.executor;

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

import org.junit.jupiter.api.Test;

class AgentToolScopeTest {

    @Test
    void readOnlyAllowsReadAndValidateTools() {
        assertTrue(AgentToolScope.READ_ONLY.allows("searchCampaigns"));
        assertTrue(AgentToolScope.READ_ONLY.allows("reward_getRuleById"));
        assertTrue(AgentToolScope.READ_ONLY.allows("countRules"));
        assertTrue(AgentToolScope.READ_ONLY.allows("checkCampaignId"));
    }

    @Test
    void readOnlyRejectsWriteAndGenerateTools() {
        assertFalse(AgentToolScope.READ_ONLY.allows("createCampaign"));
        assertFalse(AgentToolScope.READ_ONLY.allows("createRule"));
        assertFalse(AgentToolScope.READ_ONLY.allows("generateCampaignId"));
        assertFalse(AgentToolScope.READ_ONLY.allows("generateRuleId"));
    }

    @Test
    void createScopesOnlyAllowMatchingWriteTools() {
        assertTrue(AgentToolScope.CREATE_CAMPAIGN.allows("generateCampaignId"));
        assertTrue(AgentToolScope.CREATE_CAMPAIGN.allows("createCampaign"));
        assertFalse(AgentToolScope.CREATE_CAMPAIGN.allows("createRule"));

        assertTrue(AgentToolScope.CREATE_RULE.allows("generateRuleId"));
        assertTrue(AgentToolScope.CREATE_RULE.allows("createRule"));
        assertFalse(AgentToolScope.CREATE_RULE.allows("createCampaign"));
    }
}
