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.
///
/// RESERVED: the Notification Outbox dispatcher currently derives the retry policy
/// (max-retries + interval) from the central SMTP configuration for all
/// notification types — see the "retry reuses central SMTP max-retry-count and fixed
/// interval" design decision and NotificationOutboxActor.ResolveRetryPolicyAsync.
/// This per-SMS value is persisted/transported for forward-compatibility but is NOT
/// yet read at dispatch time. Honoring it per-type is a deferred enhancement (it would
/// supersede the shared-SMTP-policy decision and is not a silent behavioral change).
///
///
public int MaxRetries { get; set; }
///
/// Gets or sets the delay between retry attempts. RESERVED — see :
/// the dispatcher currently uses the shared SMTP-derived retry interval for all types.
///
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);
}
}