<?php

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

return new class extends Migration
{
    public function up(): void
    {
        // MySQL requires re-specifying the full ENUM list when altering.
        // Remove ready_for_pickup/delivered (belong on consignments) and add in_warehouse.
        DB::statement("
            ALTER TABLE `shipments`
            MODIFY COLUMN `status` ENUM(
                'received',
                'departed',
                'in_transit',
                'arrived',
                'customs_clearance',
                'in_warehouse'
            ) NOT NULL DEFAULT 'received'
        ");
    }

    public function down(): void
    {
        DB::statement("
            ALTER TABLE `shipments`
            MODIFY COLUMN `status` ENUM(
                'received',
                'departed',
                'in_transit',
                'arrived',
                'customs_clearance',
                'ready_for_pickup',
                'delivered'
            ) NOT NULL DEFAULT 'received'
        ");
    }
};
