using AIRuntime.Runtime.Agents;
using AIRuntime.Runtime.Agents.BuiltIn;
using AIRuntime.Runtime.Agents.Runtime;

using NUnit.Framework;


namespace AIRuntime.Tests
{
    public sealed class CapabilityPolicyBindingTests
    {
        [Test]
        public void RuntimeContext_AllowsGrantedCapability()
        {
            AgentDefinition agent =
                ArchitectAgentDefinition.Create();


            agent.CapabilityPolicy.Allow(
                "filesystem.read");


            AgentSession session =
                new AgentSession(
                    agent);


            AgentExecutionContext execution =
                new AgentExecutionContext(
                    session);


            AgentRuntimeContext context =
                new AgentRuntimeContext(
                    execution,
                    new System.Collections.Generic.List<AIRuntime.Runtime.Capabilities.CapabilityDescriptor>());


            Assert.IsTrue(
                context.CanUseCapability(
                    "filesystem.read"));
        }



        [Test]
        public void RuntimeContext_DeniesMissingCapability()
        {
            AgentDefinition agent =
                ArchitectAgentDefinition.Create();


            AgentSession session =
                new AgentSession(
                    agent);


            AgentExecutionContext execution =
                new AgentExecutionContext(
                    session);


            AgentRuntimeContext context =
                new AgentRuntimeContext(
                    execution,
                    new System.Collections.Generic.List<AIRuntime.Runtime.Capabilities.CapabilityDescriptor>());


            Assert.IsFalse(
                context.CanUseCapability(
                    "filesystem.delete"));
        }
    }
}