<?php

use App\Domains\Catalog\Enums\InventorySubject;
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
    {
        Schema::table('catalog_items', function (Blueprint $table): void {
            $table->enum('inventory_subject', InventorySubject::values())
                ->default(InventorySubject::Product->value)
                ->after('inventory_policy');
        });

        DB::table('catalog_items')
            ->where('tenant_code', 'desfile_pura_tendencia')
            ->where('slug', 'entrada')
            ->update(['inventory_subject' => InventorySubject::Seat->value]);
    }

    public function down(): void
    {
        Schema::table('catalog_items', function (Blueprint $table): void {
            $table->dropColumn('inventory_subject');
        });
    }
};
