<?php

namespace App\Domain\WhatsApp\Drivers;

use App\Domain\WhatsApp\Contracts\WhatsAppDriver;
use App\Domain\WhatsApp\SendResult;
use App\Models\WaMessage;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;

/** Local/dev driver — logs and "succeeds". */
class LogDriver implements WhatsAppDriver
{
    public function sendText(WaMessage $message): SendResult
    {
        Log::info('[WhatsApp:log] text', ['to' => $message->to_phone, 'body' => $message->body]);

        return SendResult::success('log_'.Str::uuid());
    }

    public function sendDocument(WaMessage $message, string $mediaUrl): SendResult
    {
        Log::info('[WhatsApp:log] document', [
            'to' => $message->to_phone, 'caption' => $message->body, 'media' => $mediaUrl,
        ]);

        return SendResult::success('log_'.Str::uuid());
    }
}
