<?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('orders', function (Blueprint $table) {
            $table->timestamp('accepted_at')->nullable()->after('status');
            $table->unsignedBigInteger('accepted_by')->nullable()->after('accepted_at');
            $table->timestamp('estimated_ready_at')->nullable()->after('accepted_by');
        });

        Schema::table('order_items', function (Blueprint $table) {
            $table->timestamp('accepted_at')->nullable()->after('status');
            $table->timestamp('ready_at')->nullable()->after('accepted_at');
            $table->unsignedSmallInteger('est_minutes')->default(15)->after('ready_at');
        });
    }

    public function down(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn(['accepted_at', 'accepted_by', 'estimated_ready_at']);
        });

        Schema::table('order_items', function (Blueprint $table) {
            $table->dropColumn(['accepted_at', 'ready_at', 'est_minutes']);
        });
    }
};
