<?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('orders', function (Blueprint $table) {
            $table->enum('pickup_status', ['not_picked_up', 'picked_up'])->default('not_picked_up')->after('production_status');
            $table->timestamp('picked_up_at')->nullable()->after('pickup_status');
            
            $table->index('pickup_status');
        });
    }

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