<?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('variety_variations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('grape_variety_id')->constrained('grape_varieties')->onDelete('cascade')->comment('Reference to grape variety');
            $table->enum('color', ['green', 'blue', 'yellow', 'red'])->comment('Color variation of the grape');
            $table->text('description')->nullable()->comment('Description of this specific variation');
            $table->decimal('typical_sugar_content', 5, 2)->nullable()->comment('Typical sugar content in NM (°NM)');
            $table->decimal('typical_alcohol', 5, 2)->nullable()->comment('Typical alcohol content percentage');
            $table->string('ripening_period')->nullable()->comment('Ripening period (e.g., September - early October)');
            $table->enum('status', ['active', 'inactive'])->default('active')->comment('Variation status');
            $table->timestamps();
        });
    }

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