using Jiaowu.Api.Domain.Academic;
using Jiaowu.Api.Infrastructure.Graduation;

namespace Jiaowu.Api.Tests;

public sealed class GraduationClearanceRulesTests
{
    [Fact]
    public void Required_items_may_be_completed_or_waived()
    {
        var records = new[]
        {
            (true, GraduationClearanceRecordStatus.Completed),
            (true, GraduationClearanceRecordStatus.Waived),
            (false, GraduationClearanceRecordStatus.Pending)
        };

        Assert.True(GraduationClearanceRules.CanClose(records));
    }

    [Fact]
    public void Pending_required_item_prevents_batch_close()
    {
        var records = new[]
        {
            (true, GraduationClearanceRecordStatus.Completed),
            (true, GraduationClearanceRecordStatus.Pending)
        };

        Assert.False(GraduationClearanceRules.CanClose(records));
    }

    [Fact]
    public void Empty_batch_cannot_be_closed()
    {
        Assert.False(GraduationClearanceRules.CanClose([]));
    }
}
