package com.pm.sms;

public class SmsGateway {
    private final SmsSender primarySender;  // 主通道（API）
    private final SmsSender backupSender;   // 备用通道（GSM）
    
    public SmsGateway() throws Exception {
        this.primarySender = new ApiSmsSender();
        this.backupSender = new SmsSender() {
            @Override
            public boolean sendAlert(String phone, String message) {
                return false;
            }
        };
    }
    
    public void sendAlert(String phone, String message) {
        if (!primarySender.sendAlert(phone, message)) {
            System.out.println("主通道失败，切换备用通道");
           // backupSender.sendAlert(phone, message);
        }
    }
}