using System;
using StellaOps.Authority.Plugins.Abstractions;

namespace StellaOps.Authority.Plugins.Abstractions.Tests;

public class AuthorityClientRegistrationTests
{
    [Fact]
    public void Constructor_Throws_WhenClientIdMissing()
    {
        Assert.Throws<ArgumentException>(() => new AuthorityClientRegistration(string.Empty, false, null, null));
    }

    [Fact]
    public void Constructor_RequiresSecret_ForConfidentialClients()
    {
        Assert.Throws<ArgumentException>(() => new AuthorityClientRegistration("cli", true, null, null));
    }

    [Fact]
    public void WithClientSecret_ReturnsCopy()
    {
        var registration = new AuthorityClientRegistration("cli", false, null, null);

        var updated = registration.WithClientSecret("secret");

        Assert.Equal("cli", updated.ClientId);
        Assert.Equal("secret", updated.ClientSecret);
        Assert.False(updated.Confidential);
    }
}
