using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;

namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Notifications;

/// <summary>
/// Query filter for the central notification outbox. All members are optional;
/// an unset member means "no constraint on that dimension".
/// </summary>
/// <param name="Status">Restrict to a single lifecycle status.</param>
/// <param name="Type">Restrict to a single delivery channel.</param>
/// <param name="SourceSiteId">Restrict to notifications originating at a given site.</param>
/// <param name="ListName">Restrict to a single notification list.</param>
/// <param name="SubjectKeyword">Substring matched against <c>Subject</c>.</param>
/// <param name="StuckOnly">
/// When <c>true</c>, restrict to non-terminal rows (Pending/Retrying) whose
/// <c>CreatedAt</c> is older than <see cref="StuckCutoff"/>.
/// </param>
/// <param name="StuckCutoff">Rows with <c>CreatedAt</c> older than this count as stuck.</param>
/// <param name="From">Inclusive lower bound on <c>CreatedAt</c>.</param>
/// <param name="To">Inclusive upper bound on <c>CreatedAt</c>.</param>
/// <param name="SourceNode">
/// Restrict to notifications originating at a specific cluster node (e.g.
/// <c>"central-a"</c>, <c>"site-plant-a-node-a"</c>). Exact match; <c>null</c>
/// means "do not constrain".
/// </param>
public record NotificationOutboxFilter(
    NotificationStatus? Status = null,
    NotificationType? Type = null,
    string? SourceSiteId = null,
    string? ListName = null,
    string? SubjectKeyword = null,
    bool StuckOnly = false,
    DateTimeOffset? StuckCutoff = null,
    DateTimeOffset? From = null,
    DateTimeOffset? To = null,
    string? SourceNode = null);
