<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * INT-01 from the system analysis: booking confirmations only went out over
 * SMS/email. Twilio's WhatsApp API reuses the same Messages endpoint SMS
 * already goes through (just a "whatsapp:" prefix on the To/From numbers)
 * so this reuses the existing sms_api_key credential — only a distinct
 * WhatsApp-approved sender number is new, since that's a separate Twilio
 * onboarding step from a plain SMS number.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->string('whatsapp_sender_id', 30)->nullable()->after('sms_template');
        });
    }

    public function down(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->dropColumn('whatsapp_sender_id');
        });
    }
};
