using ScadaLink.Commons.Types.Enums; namespace ScadaLink.StoreAndForward; /// /// WP-9: Represents a single store-and-forward message as stored in SQLite. /// Maps to the sf_messages table. /// public class StoreAndForwardMessage { /// Unique message ID (GUID). public string Id { get; set; } = string.Empty; /// WP-9: Category: ExternalSystem, Notification, or CachedDbWrite. public StoreAndForwardCategory Category { get; set; } /// Target system name (external system, notification list, or DB connection). public string Target { get; set; } = string.Empty; /// JSON-serialized payload containing the call details. public string PayloadJson { get; set; } = string.Empty; /// /// Number of retry-sweep attempts performed so far. The initial (immediate or /// caller-made) delivery attempt is attempt 0 and is not counted here; this /// field counts only background retry attempts (StoreAndForward-003). /// public int RetryCount { get; set; } /// /// Maximum retry-sweep attempts before the message is parked. /// 0 = no limit — the message is retried on every sweep until delivered /// and is never parked for exhausting retries. This is not a "never retry" /// value; a positive value is required to bound delivery attempts. /// public int MaxRetries { get; set; } /// Retry interval in milliseconds. public long RetryIntervalMs { get; set; } /// When this message was first enqueued. public DateTimeOffset CreatedAt { get; set; } /// When delivery was last attempted (null if never attempted). public DateTimeOffset? LastAttemptAt { get; set; } /// Current status of the message. public StoreAndForwardMessageStatus Status { get; set; } /// Last error message from a failed delivery attempt. public string? LastError { get; set; } /// /// Instance that originated this message (for S&F-survives-delete behavior). /// WP-13: Messages are NOT cleared when instance is deleted. /// public string? OriginInstanceName { get; set; } }