using TeleWave.Domain.Broadcast;
using Xunit;

namespace TeleWave.Domain.Tests.Broadcast;

public class ScheduleEntryTests
{
    private static readonly DateTimeOffset Start = new(2026, 1, 1, 0, 0, 0, TimeSpan.Zero);

    [Fact]
    public void Program_SetsKindAndEpg()
    {
        var channel = Guid.NewGuid();
        var asset = Guid.NewGuid();
        var show = Guid.NewGuid();

        var e = ScheduleEntry.Program(channel, asset, Start, Start.AddMinutes(20), show, 3);

        Assert.Equal(ScheduleEntryKind.Program, e.Kind);
        Assert.Equal(show, e.ShowId);
        Assert.Equal(3, e.EpisodeIndex);
        Assert.Null(e.BumperVariantId);
    }

    [Fact]
    public void Ad_HasNoShow()
    {
        var e = ScheduleEntry.Ad(Guid.NewGuid(), Guid.NewGuid(), Start, Start.AddMinutes(1));

        Assert.Equal(ScheduleEntryKind.Ad, e.Kind);
        Assert.Null(e.ShowId);
        Assert.Null(e.EpisodeIndex);
    }

    [Fact]
    public void Bumper_CarriesShowAndVariant()
    {
        var toShow = Guid.NewGuid();
        var variant = Guid.NewGuid();

        var e = ScheduleEntry.Bumper(
            Guid.NewGuid(),
            Guid.NewGuid(),
            Start,
            Start.AddSeconds(8),
            toShow,
            variant
        );

        Assert.Equal(ScheduleEntryKind.Bumper, e.Kind);
        Assert.Equal(toShow, e.ShowId);
        Assert.Equal(variant, e.BumperVariantId);
    }
}
