Files
TeleWave/backend/src/TeleWave.Application/Programming/Templates/Generate/GridPlan.cs
T
Leonid Pershin f7e7b5f7c3
ci / build-backend (push) Successful in 1m31s
ci / build-frontend (push) Successful in 1m5s
ci / tests (push) Successful in 3m54s
ci / sonar (push) Successful in 4m40s
Implement template export/import endpoints and enhance grid generation logic
Added new endpoints for exporting and importing grid configurations in TemplateEndpoints, allowing for better management of template data. Enhanced the GenerateGridCommandHandler to support seasonal layers in grid generation, improving scheduling accuracy during holiday periods. Updated related classes and records to accommodate these changes, ensuring a cohesive integration of new features. Improved documentation for clarity and maintainability.
2026-07-28 02:15:04 +03:00

65 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using TeleWave.Domain.Programming;
namespace TeleWave.Application.Programming.Templates.Generate;
/// <summary>Что делать с тем, что в сетке уже есть.</summary>
public enum GridGenerationMode
{
/// <summary>Только незакрытые интервалы; ручные слоты не трогаются.</summary>
FillGaps = 0,
/// <summary>Снести все слоты шаблона и построить неделю заново.</summary>
Rebuild = 1,
}
/// <summary>Куда ложится слот. Имена слоёв — в <see cref="GridPlanner"/>.</summary>
public enum GridPlanLayer
{
Main = 0,
Weekend = 1,
/// <summary>Праздничная сетка: слой поверх основного, действующий только в свои даты.</summary>
Season = 2,
}
/// <summary>
/// Будущий слот: то же, что <see cref="SlotInput"/>, но без слоя и идентификаторов. Сравнивается
/// по значению — на этом держится схлопывание одинаковых дней в один слот «каждый день».
/// </summary>
public sealed record PlannedSlot(
GridPlanLayer Layer,
int? Weekday,
TimeOnly Start,
int DurationMinutes,
string Title,
Daypart Daypart,
SlotKind SlotKind,
Guid? GroupId,
string? GroupName,
SlotBlockMode BlockMode,
int BlockValue,
SlotStrategy? Strategy,
RepeatSource? RepeatSource,
/// <summary>Жёсткий старт. Ставится в начале прайма: кино должно начинаться в объявленное время.</summary>
bool IsAnchor
);
/// <summary>
/// Результат разбора: что будет создано, что снесено и о чём стоит знать заранее. Считается и для
/// предпросмотра, и для самой генерации — одним и тем же кодом, поэтому показанное совпадает
/// с созданным.
/// </summary>
/// <param name="FreeMinutes">Сколько минут недели генератор считал свободными.</param>
/// <param name="CoveredMinutes">Сколько из них закрыто слотами плана.</param>
public sealed record GridPlan(
GridProfile Profile,
GridGenerationMode Mode,
IReadOnlyList<PlannedSlot> Slots,
IReadOnlyList<PlanNote> Notes,
int SlotsToRemove,
Guid? FallbackGroupId,
string? FallbackGroupName,
int FreeMinutes,
int CoveredMinutes
);