<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('client_versions', function (Blueprint $table) {
            $table->id();

            $table->string('title');
            $table->enum('tag', ['addon', 'customization']);

            $table->text('description')->nullable();
            $table->decimal('cost', 10, 2);
            $table->string('timeline');

            $table->string('version');
            $table->text('note')->nullable();

            $table->foreignId('product_id')
                ->nullable()
                ->constrained('products')
                ->nullOnDelete();

            $table->foreignId('category_id')
                ->nullable()
                ->constrained('product_categories')
                ->nullOnDelete();

            $table->timestamps();
        });
    }

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