<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\GrapeVariety;

class GrapeVarietySeeder extends Seeder
{
    use WithoutModelEvents;

    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $varieties = [
            [
                'variety_name' => 'Grüner Veltliner',
                'description' => 'The most widespread white wine variety in the Czech Republic, producing fresh wines with light acidity.',
                'origin' => 'Austria',
                'wine_type' => 'white',
                'characteristics' => 'Fresh, fruity aromas, light acidity, piquant taste',
                'image_url' => 'https://example.com/images/gruner-veltliner.jpg',
            ],
            [
                'variety_name' => 'Riesling',
                'description' => 'Premium white wine variety with a distinctive bouquet and mineral tones.',
                'origin' => 'Rhine, Germany',
                'wine_type' => 'white',
                'characteristics' => 'Mineral, acidic, elegant, long-aging potential',
                'image_url' => 'https://example.com/images/riesling.jpg',
            ],
            [
                'variety_name' => 'Blaufränkisch',
                'description' => 'Classic red wine variety typical for Moravia.',
                'origin' => 'France',
                'wine_type' => 'red',
                'characteristics' => 'Distinctive, spicy, tannic, long-aging potential',
                'image_url' => 'https://example.com/images/blaufrankisch.jpg',
            ],
            [
                'variety_name' => 'St. Laurent',
                'description' => 'Quality red wine with soft taste and delicate tannins.',
                'origin' => 'Austria',
                'wine_type' => 'red',
                'characteristics' => 'Delicate, fruity, soft tannins, velvety taste',
                'image_url' => 'https://example.com/images/st-laurent.jpg',
            ],
            [
                'variety_name' => 'Müller Thurgau',
                'description' => 'Popular white wine with a subtle muscat aroma.',
                'origin' => 'Switzerland',
                'wine_type' => 'white',
                'characteristics' => 'Muscat, fresh, young wines',
                'image_url' => 'https://example.com/images/muller-thurgau.jpg',
            ],
            [
                'variety_name' => 'Chardonnay',
                'description' => 'World-renowned variety producing complex white wines with aging potential.',
                'origin' => 'Burgundy, France',
                'wine_type' => 'white',
                'characteristics' => 'Complex, buttery, vanilla (after oak barrel), full-bodied',
                'image_url' => 'https://example.com/images/chardonnay.jpg',
            ],
        ];

        foreach ($varieties as $variety) {
            GrapeVariety::updateOrCreate(
                ['variety_name' => $variety['variety_name']],
                $variety
            );
        }

        if ($this->command) {
            $this->command->info('✓ Created ' . count($varieties) . ' grape varieties');
        }
    }
}
