using Microsoft.Maui.ApplicationModel.Communication;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Justice.Services
{
public class SmsService
{
///
/// Sends a bulk SMS message to a list of phone numbers.
///
/// List of phone numbers to send the SMS to.
/// The message to send.
public async Task SendBulkSmsAsync(List phoneNumbers, string message)
{
foreach (var number in phoneNumbers)
{
try
{
var sms = new SmsMessage(message, new[] { number });
await Sms.ComposeAsync(sms);
}
catch (FeatureNotSupportedException)
{
Console.WriteLine($"SMS not supported on this device for number {number}.");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to send SMS to {number}: {ex.Message}");
}
}
}
}
}