<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            // Expand status — SQLite-friendly: just use string
            $table->string('work_status')->default('open')->after('status');
            $table->text('target_info')->nullable()->after('work_status');
            $table->text('admin_notes')->nullable()->after('target_info');
            $table->string('assigned_to')->nullable()->after('admin_notes'); // comma-separated employee IDs
            $table->timestamp('closed_at')->nullable()->after('assigned_to');
        });
    }

    public function down(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn(['work_status', 'target_info', 'admin_notes', 'assigned_to', 'closed_at']);
        });
    }
};
