<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        DB::table('notification_settings')
            ->where('type', 'customer')
            ->where('module_type', 'all')
            ->whereIn('key', [
                'customer_order_placed',
                'customer_order_confirmed',
                'customer_order_packaging',
                'customer_order_handed_to_courier',
                'customer_order_out_for_delivery',
                'customer_order_delivered',
                'customer_order_returned',
            ])
            ->where('sms_status', 'disable')
            ->update([
                'sms_status' => 'inactive',
                'updated_at' => now(),
            ]);
    }

    public function down(): void
    {
        DB::table('notification_settings')
            ->where('type', 'customer')
            ->where('module_type', 'all')
            ->whereIn('key', [
                'customer_order_placed',
                'customer_order_confirmed',
                'customer_order_packaging',
                'customer_order_handed_to_courier',
                'customer_order_out_for_delivery',
                'customer_order_delivered',
                'customer_order_returned',
            ])
            ->where('sms_status', 'inactive')
            ->update([
                'sms_status' => 'disable',
                'updated_at' => now(),
            ]);
    }
};
