namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications;
public class SmsConfiguration
{
/// Gets or sets the primary key.
public int Id { get; set; }
/// Gets or sets the Twilio Account SID.
public string AccountSid { get; set; }
///
/// Gets or sets the Twilio Auth Token (secret). Stored encrypted; null only transiently
/// during configuration, never a valid production value.
///
public string? AuthToken { get; set; }
///
/// Gets or sets the sender phone number (E.164) placed in the From field, or null when
/// delivery is via a instead. A valid config has a
/// FromNumber and/or a MessagingServiceSid; that either-or invariant is enforced at the
/// management/UI boundary and again by the delivery adapter (it is not a ctor invariant
/// because MessagingServiceSid is a settable property assigned after construction).
///
public string? FromNumber { get; set; }
/// Gets or sets the Twilio Messaging Service SID used instead of a From number, or null.
public string? MessagingServiceSid { get; set; }
/// Gets or sets the Twilio REST API base URL, or null to use the provider default.
public string? ApiBaseUrl { get; set; }
/// Gets or sets the connection timeout in seconds. Honored per-send by the SMS delivery adapter.
public int ConnectionTimeoutSeconds { get; set; }
///
/// Gets or sets the maximum number of delivery retries before parking.
///
/// LIVE for SMS: the Notification Outbox dispatcher selects the retry policy by
/// notification Type — SMS notifications retry under this value (and
/// ), while Email (and every other type) uses the central SMTP
/// policy. When no SMS configuration row exists the dispatcher falls back to the SMTP
/// policy. A non-positive value is clamped to the outbox fallback (10) with a Warning so
/// a misconfiguration cannot silently park SMS on the first transient failure. See
/// NotificationOutboxActor.ResolveRetryPoliciesAsync.
///
///
public int MaxRetries { get; set; }
///
/// Gets or sets the delay between retry attempts. LIVE for SMS — see
/// : the dispatcher schedules the next SMS attempt with this delay
/// (clamped to the 1-minute fallback if non-positive), falling back to the SMTP interval
/// when no SMS configuration exists.
///
public TimeSpan RetryDelay { get; set; }
///
/// Initializes a new with the required Account SID and
/// sensible defaults for the numeric and timeout fields.
/// is optional — a Twilio Messaging-Service-only config sets
/// instead and leaves the From number null.
///
/// Twilio Account SID.
/// Sender phone number (E.164) for the From field, or null for a Messaging-Service-only config.
public SmsConfiguration(string accountSid, string? fromNumber = null)
{
AccountSid = accountSid ?? throw new ArgumentNullException(nameof(accountSid));
FromNumber = fromNumber;
ConnectionTimeoutSeconds = 30;
MaxRetries = 10;
RetryDelay = TimeSpan.FromMinutes(1);
}
}