<?php

use App\Database\Blueprint;
use App\Enums\EmailAttachmentTypeEnum;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        DB::statement('CREATE TABLE order_archives LIKE orders; ');
        Schema::table('order_archives', function (Blueprint $table) {
            $table->string('profit_center_name')->nullable();
            $table->string('supplier_name')->nullable();
            $table->string('emailAttachmentType')->nullable();
            $table->enum('supplier_emailAttachmentType', EmailAttachmentTypeEnum::getValues())->nullable();

            $table->timestamp('original_created_at')->nullable();
            $table->timestamp('original_updated_at')->nullable();
            $table->timestamp('original_deleted_at')->nullable();
            $table->integer('original_created_by')->nullable()->unsigned();
            $table->integer('original_updated_by')->nullable()->nullable();
            $table->integer('original_deleted_by')->nullable()->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('order_archives');
    }
};
