<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('restocks', function (Blueprint $table) {
            $table->id();

            $table->foreignId('created_by_id')->constrained('users')->cascadeOnDelete();

            $table->unsignedBigInteger('total');
            $table->string('notes', 100)->nullable();
            $table->enum('stock_type', ProductStockQuality::values())->default(ProductStockQuality::GOOD->value);

            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('restocks');
    }
};
