<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class WinerySeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * This is the master seeder that orchestrates all winery-related seeders
     * in the correct order to respect foreign key constraints.
     */
    public function run(): void
    {
        if ($this->command) {
            $this->command->info('🍇 Seeding Winery Data...');
            $this->command->newLine();
        }

        // Seed in correct order due to foreign key dependencies
        $this->call([
            GrapeVarietySeeder::class,      // 1. Base grape varieties
            GrapeVarietyVariantSeeder::class, // 2. Variants depend on varieties
            VarietyVariationSeeder::class,  // 2. Variations depend on varieties
            VineyardRowSeeder::class,       // 3. Rows depend on variations
            HarvestSeeder::class,           // 4. Harvests depend on rows and variations
            WineSeeder::class,              // 5. Wines depend on varieties
            WineProductionSeeder::class,    // 6. Productions depend on wines and harvests
        ]);

        if ($this->command) {
            $this->command->newLine();
            $this->command->info('✅ Winery seeding completed successfully!');
        }
    }
}
