<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table): void {
            $table->boolean('login_otp_enabled')->default(false)->after('last_login_at');
        });

        Schema::table('orders', function (Blueprint $table): void {
            $table->string('pickup_code', 50)->nullable()->after('payment_method');
            $table->text('shipping_address')->nullable()->after('notes');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('orders', function (Blueprint $table): void {
            $table->dropColumn(['pickup_code', 'shipping_address']);
        });

        Schema::table('users', function (Blueprint $table): void {
            $table->dropColumn('login_otp_enabled');
        });
    }
};
