using BuildingBlock.Identity.Contracts.Abstractions;
using BuildingBlock.Identity.Contracts.Conventions;
using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;

namespace BuildingBlock.Identity.Contracts.UnitTests;

public class ContractShapeTests
{
    [Fact]
    public void IdentityEnvelope_WhenCreated_PreservesValues()
    {
        var envelope = new IdentityContractEnvelope("1.0.0", "corr-identity-001");

        Assert.Equal("1.0.0", envelope.ContractVersion);
        Assert.Equal("corr-identity-001", envelope.CorrelationId);
    }

    [Fact]
    public void IdentityContracts_WhenInstantiated_ImplementMarkerInterface()
    {
        IIdentityCapabilityContract issueRequest = new IssueIdentityTokenRequest("subject-a", "tenant-a");
        IIdentityCapabilityContract issueResponse = new IssueIdentityTokenResponse("token-a", 1800);
        IIdentityCapabilityContract policyRequest = new EvaluateIdentityPolicyRequest("subject-b", "tenant-b", "identity.token.issue");
        IIdentityCapabilityContract policyResponse = new EvaluateIdentityPolicyResponse("subject-b", "identity.token.issue", true);
        IIdentityCapabilityContract refreshRequest = new RefreshIdentitySessionRequest("refresh-a", "corr-refresh");
        IIdentityCapabilityContract refreshResponse = new RefreshIdentitySessionResponse("token-b", 900);

        Assert.NotNull(issueRequest);
        Assert.NotNull(issueResponse);
        Assert.NotNull(policyRequest);
        Assert.NotNull(policyResponse);
        Assert.NotNull(refreshRequest);
        Assert.NotNull(refreshResponse);
    }
}
