<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Enums\PricelistFileStatusEnum;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('pricelist_files', function ($table) {
            $table->integer('file_size')->nullable()->after('filename');
            $table->enum('status', array_column(PricelistFileStatusEnum::cases(), 'value'))->default(PricelistFileStatusEnum::todo->value)->after('file_size');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('pricelist_files', function ($table) {
            $table->dropColumn(['file_size', 'status']);
        });
    }
};
