using ErsatzTV.Application.ProgramSchedules;

namespace ErsatzTV.Controllers.Api.Requests;

public record ReplaceScheduleItemsRequest(List<ScheduleItemRequest> Items)
{
    public ReplaceProgramScheduleItems ToCommand(int scheduleId, Option<Seq<int>> expectedVersions = default) =>
        new(
            scheduleId,
            (Items ?? []).Select((item, index) => item.ToReplaceCommand(index)).ToList(),
            expectedVersions);
}
