<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table): void {
            $table->string('language', 10)
                ->default('fr')
                ->after('email_notifications_enabled');
            $table->string('region', 10)
                ->default('FR')
                ->after('language');
            $table->boolean('push_notifications_enabled')
                ->default(true)
                ->after('region');
            $table->boolean('sms_notifications_enabled')
                ->default(false)
                ->after('push_notifications_enabled');
            $table->boolean('email_marketing_enabled')
                ->default(true)
                ->after('sms_notifications_enabled');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table): void {
            $table->dropColumn([
                'language',
                'region',
                'push_notifications_enabled',
                'sms_notifications_enabled',
                'email_marketing_enabled',
            ]);
        });
    }
};
