using KArtSell.BuildingBlocks.DataIntegrity;

namespace KArtSell.SignalEngine.UnitTests.BuildingBlocks;

public sealed class PitRecordMetadataTests
{
    [Fact]
    public void Quarantined_record_is_never_usable()
    {
        var published = new DateTimeOffset(2026, 1, 2, 0, 0, 0, TimeSpan.Zero);
        var record = new PitRecordMetadata(
            "source-1", published, published, published.AddMinutes(1), published, null,
            0, "hash", "dataset", DataQualityStatus.Quarantined);

        Assert.False(record.IsUsableAt(published.AddDays(1)));
    }

    [Fact]
    public void Pass_record_is_usable_only_after_publication()
    {
        var published = new DateTimeOffset(2026, 1, 2, 0, 0, 0, TimeSpan.Zero);
        var record = new PitRecordMetadata(
            "source-1", published, published, published.AddMinutes(1), published, null,
            0, "hash", "dataset", DataQualityStatus.Pass);

        Assert.False(record.IsUsableAt(published.AddTicks(-1)));
        Assert.True(record.IsUsableAt(published));
    }
}
