<?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('vineyard_rows', function (Blueprint $table) {
            $table->id();
            $table->foreignId('variety_variation_id')->nullable()->constrained('variety_variations')->onDelete('cascade')->comment('Reference to variety variation');
            $table->integer('vine_count')->comment('Number of vine plants/heads in this row');
            $table->integer('planting_year')->comment('Year when the row was planted');
            $table->decimal('area', 8, 2)->nullable()->comment('Area size in hectares');
            $table->string('location')->nullable()->comment('Physical location description');
            $table->enum('status', ['active', 'inactive', 'replanting'])->default('active')->comment('Row status');
            $table->text('notes')->nullable()->comment('Additional notes and observations');
            $table->timestamps();
        });
    }

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