<?php

namespace App\Services;

class SmsService
{
    public function providerReady(): bool
    {
        return config('services.sms.provider') !== 'pending' && filled(config('services.sms.api_key'));
    }

    public function send(int $schoolId, array $recipients, string $body): array
    {
        if (! $this->providerReady()) {
            return [
                'success' => false,
                'message' => 'SMS provider هنوز تنظیم نشده است. مستندات و API key لازم است.',
                'sent' => 0,
            ];
        }

        app(SmsWalletService::class)->ensureCanSend($schoolId, count($recipients));

        // Provider adapter will be implemented after provider documentation/API key is provided.
        return [
            'success' => false,
            'message' => 'SMS provider adapter هنوز پیاده‌سازی نشده است.',
            'sent' => 0,
        ];
    }
}
