<?php

namespace Modules\PortalApi\Services\Sms;

use Illuminate\Support\Facades\Log;

/**
 * Default dev SMS driver — writes the OTP to storage/logs/laravel.log
 * so you can grep "[PortalSMS]" to find codes during development.
 *
 * Swap for TwilioSmsGateway in production.
 */
class LogSmsGateway implements PortalSmsGateway
{
    public function sendOtp(string $phone, string $code, int $ttlMinutes): bool
    {
        // Use the application's default log channel (daily by default) so the
        // OTP lands in the same file the user is already tailing.
        Log::info('[PortalSMS] OTP delivery (dev log driver)', [
            'phone'   => $phone,
            'code'    => $code,
            'expires' => "in {$ttlMinutes}m",
        ]);
        return true;
    }
}
