<?php

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

return new class extends Migration
{
    public function up(): void
    {
        $keys = [
            'customer_order_placed',
            'customer_order_confirmed',
            'customer_order_packaging',
            'customer_order_handed_to_courier',
            'customer_order_out_for_delivery',
            'customer_order_delivered',
        ];

        DB::table('notification_settings')
            ->where('type', 'customer')
            ->whereIn('key', $keys)
            ->update(['push_notification_status' => 'active']);
    }

    public function down(): void
    {
        $keys = [
            'customer_order_placed',
            'customer_order_confirmed',
            'customer_order_packaging',
            'customer_order_handed_to_courier',
            'customer_order_out_for_delivery',
            'customer_order_delivered',
        ];

        DB::table('notification_settings')
            ->where('type', 'customer')
            ->whereIn('key', $keys)
            ->update(['push_notification_status' => 'disable']);
    }
};
