<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Package;
use App\Enums\PackageType;

class PackageSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $packages = [
            
            [
                'slug' => 'starter',
                'name' => 'Starter',
                'name_translations' => [
                    'de' => 'Starter',
                    'en' => 'Starter',
                ],
                'type' => PackageType::ENDCUSTOMER,
                'price' => 29.00,
                'max_photos' => 300,
                'max_guests' => 50,
                'gallery_days' => 14,
                'max_tasks' => 30,
                'watermark_allowed' => true,
                'branding_allowed' => false,
                'features' => ['basic_uploads', 'custom_tasks'],
                'paddle_product_id' => 'pro_01k8jcxx2g1vj9snqbga4283ej',
                'paddle_price_id' => 'pri_01k8jcxx8qktxvqzzv0nkjjj27',
                'description' => <<<TEXT
Ideal für Geburtstage, Gartenpartys oder Polterabende! {{max_guests}} Gäste teilen ihre besten Schnappschüsse, lösen {{max_tasks}} Fotoaufgaben und haben {{gallery_duration}} Zugriff auf die Online-Galerie. {{max_photos}} Bilder sind inklusive – genug Platz für jede Menge Lieblingsmomente.
TEXT,
                'description_translations' => [
                    'de' => 'Ideal für Geburtstage, Gartenpartys oder Polterabende! {{max_guests}} Gäste teilen ihre besten Schnappschüsse, lösen {{max_tasks}} Fotoaufgaben und haben {{gallery_duration}} Zugriff auf die Online-Galerie. {{max_photos}} Bilder sind inklusive – genug Platz für jede Menge Lieblingsmomente.',
                    'en' => 'Ideal for birthdays, garden parties or rehearsal dinners! {{max_guests}} guests share their favourite snapshots, take on {{max_tasks}} photo challenges and enjoy gallery access for {{gallery_duration}}. {{max_photos}} photos included for all those memories.',
                ],
                'description_table' => [
                    ['title' => 'Fotos', 'value' => '{{max_photos}}'],
                    ['title' => 'Gäste', 'value' => '{{max_guests}}'],
                    ['title' => 'Aufgaben', 'value' => '{{max_tasks}} Fotoaufgaben'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Branding', 'value' => 'Fotospiel Branding'],
                ],
            ],
            [
                'slug' => 'standard',
                'name' => 'Standard',
                'name_translations' => [
                    'de' => 'Standard',
                    'en' => 'Standard',
                ],
                'type' => PackageType::ENDCUSTOMER,
                'price' => 59.00,
                'max_photos' => 1000,
                'max_guests' => 150,
                'gallery_days' => 30,
                'max_tasks' => 100,
                'watermark_allowed' => false,
                'branding_allowed' => true,
                'features' => ['basic_uploads', 'custom_branding', 'custom_tasks'],
                'paddle_product_id' => 'pro_01k8jcxwjv4ne8vf9pvd9bye3j',
                'paddle_price_id' => 'pri_01k8jcxws51pze5xc3vj2ea0yc',
                'description' => <<<TEXT
Das Rundum-Sorglos-Paket für Hochzeiten, Firmenfeiern oder Jubiläen. {{max_photos}} Bilder, {{max_guests}} Gäste und {{max_tasks}} Fotoaufgaben – dazu eine Galerie, die {{gallery_duration}} online bleibt. Eigenes Logo oder Wasserzeichen inklusive.
TEXT,
                'description_translations' => [
                    'de' => 'Das Rundum-Sorglos-Paket für Hochzeiten, Firmenfeiern oder Jubiläen. {{max_photos}} Bilder, {{max_guests}} Gäste und {{max_tasks}} Fotoaufgaben – dazu eine Galerie, die {{gallery_duration}} online bleibt. Eigenes Logo oder Wasserzeichen inklusive.',
                    'en' => 'The all-in-one package for weddings, corporate events or anniversaries. {{max_photos}} photos, {{max_guests}} guests and {{max_tasks}} photo challenges—plus a gallery that stays online for {{gallery_duration}}. Includes your own logo or watermark.',
                ],
                'description_table' => [
                    ['title' => 'Fotos', 'value' => '{{max_photos}}'],
                    ['title' => 'Gäste', 'value' => '{{max_guests}}'],
                    ['title' => 'Aufgaben', 'value' => '{{max_tasks}} Fotoaufgaben'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Branding', 'value' => 'Eigenes Logo & Wasserzeichen'],
                ],
            ],
            [
                'slug' => 'pro',
                'name' => 'Premium',
                'name_translations' => [
                    'de' => 'Premium',
                    'en' => 'Premium',
                ],
                'type' => PackageType::ENDCUSTOMER,
                'price' => 129.00,
                'max_photos' => 3000,
                'max_guests' => 500,
                'gallery_days' => 180,
                'max_tasks' => 200,
                'watermark_allowed' => false,
                'branding_allowed' => true,
                'features' => ['basic_uploads', 'custom_branding', 'advanced_analytics', 'live_slideshow', 'priority_support'],
                'paddle_product_id' => 'pro_01k8jcxvwp38gay6jj2akjg76s',
                'paddle_price_id' => 'pri_01k8jcxw5sap4r306wcvc0ephy',
                'description' => <<<TEXT
Das volle Erlebnis für alle, die keine Kompromisse machen wollen. {{max_photos}} Bilder, {{max_guests}} Gäste, {{gallery_duration}} Galerie-Zugang und {{max_tasks}} Aufgaben – dazu kein Wasserzeichen, Live-Slideshow und Premium-Support.
TEXT,
                'description_translations' => [
                    'de' => 'Das volle Erlebnis für alle, die keine Kompromisse machen wollen. {{max_photos}} Bilder, {{max_guests}} Gäste, {{gallery_duration}} Galerie-Zugang und {{max_tasks}} Aufgaben – dazu kein Wasserzeichen, Live-Slideshow und Premium-Support.',
                    'en' => 'The full experience for anyone who refuses to compromise. {{max_photos}} photos, {{max_guests}} guests, {{gallery_duration}} of gallery access and {{max_tasks}} challenges—no watermark, live slideshow and premium support included.',
                ],
                'description_table' => [
                    ['title' => 'Fotos', 'value' => '{{max_photos}}'],
                    ['title' => 'Gäste', 'value' => '{{max_guests}}'],
                    ['title' => 'Aufgaben', 'value' => '{{max_tasks}} Fotoaufgaben'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Extras', 'value' => 'Live-Slideshow & Premium-Support'],
                ],
            ],
            [
                'slug' => 'premium',
                'name' => 'Premium',
                'name_translations' => [
                    'de' => 'Premium',
                    'en' => 'Premium',
                ],
                'type' => PackageType::ENDCUSTOMER,
                'price' => 149.00,
                'max_photos' => 5000,
                'max_guests' => 1000,
                'gallery_days' => 180,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => false,
                'features' => ['basic_uploads', 'unlimited_sharing', 'custom_branding', 'custom_tasks'],
                'paddle_product_id' => 'pro_01k8jcxsmxrs45v1qvtpsepn13',
                'paddle_price_id' => 'pri_01k8jcxswh74jv8vy5q7a4h70p',
                'description' => null,
                'description_translations' => null,
                'description_table' => [],
            ],
            [
                'slug' => 's-small-reseller',
                'name' => 'Reseller S',
                'name_translations' => [
                    'de' => 'Reseller S',
                    'en' => 'Reseller S',
                ],
                'type' => PackageType::RESELLER,
                'price' => 149.00,
                'max_photos' => 1000,
                'max_guests' => null,
                'gallery_days' => 30,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 5,
                'expires_after' => now()->copy()->addYear(),
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support'],
                'paddle_product_id' => 'pro_01k8jcxvax48mhmwsfydw8ha9y',
                'paddle_price_id' => 'pri_01k8jcxvhe0bfasg9gg1rw70sy',
                'description' => <<<TEXT
Das perfekte Paket für Fotografen oder Planer, die erste Erfahrungen mit Fotospiel sammeln wollen. Enthalten sind {{max_events_per_year}} Events pro Jahr mit Standard-Leistung – Branding-Optionen inklusive.
TEXT,
                'description_translations' => [
                    'de' => 'Das perfekte Paket für Fotografen oder Planer, die erste Erfahrungen mit Fotospiel sammeln wollen. Enthalten sind {{max_events_per_year}} Events pro Jahr mit Standard-Leistung – Branding-Optionen inklusive.',
                    'en' => 'Perfect for photographers or planners getting started with Fotospiel. Includes {{max_events_per_year}} events per year with the standard feature set—branding options included.',
                ],
                'description_table' => [
                    ['title' => 'Events/Jahr', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Branding', 'value' => 'Logo & Farben pro Event'],
                ],
            ],
            [
                'slug' => 'm-medium-reseller',
                'name' => 'Reseller M',
                'name_translations' => [
                    'de' => 'Reseller M',
                    'en' => 'Reseller M',
                ],
                'type' => PackageType::RESELLER,
                'price' => 349.00,
                'max_photos' => 1500,
                'max_guests' => null,
                'gallery_days' => 60,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 15,
                'expires_after' => now()->copy()->addYear(),
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting'],
                'paddle_product_id' => 'pro_01k8jcxtrxw7jsew52jnax901q',
                'paddle_price_id' => 'pri_01k8jcxv06nsgy8ym8mnfrfm5v',
                'description' => <<<TEXT
Wenn du regelmäßig Hochzeiten, Firmenfeste oder private Events betreust, ist dieses Paket ideal. {{max_events_per_year}} Events pro Jahr mit Branding-Optionen, verlängerter Galerie-Laufzeit und Reporting inklusive.
TEXT,
                'description_translations' => [
                    'de' => 'Wenn du regelmäßig Hochzeiten, Firmenfeste oder private Events betreust, ist dieses Paket ideal. {{max_events_per_year}} Events pro Jahr mit Branding-Optionen, verlängerter Galerie-Laufzeit und Reporting inklusive.',
                    'en' => 'Designed for professionals who regularly support weddings, corporate events or private parties. {{max_events_per_year}} events per year with branding options, extended gallery runtime and reporting included.',
                ],
                'description_table' => [
                    ['title' => 'Events/Jahr', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Reporting', 'value' => 'Erweiterte Auswertungen'],
                ],
            ],
            [
                'slug' => 'l-large-reseller',
                'name' => 'Reseller L',
                'name_translations' => [
                    'de' => 'Reseller L',
                    'en' => 'Reseller L',
                ],
                'type' => PackageType::RESELLER,
                'price' => 699.00,
                'max_photos' => 3000,
                'max_guests' => null,
                'gallery_days' => 90,
                'max_tasks' => null,
                'watermark_allowed' => false,
                'branding_allowed' => true,
                'max_events_per_year' => 40,
                'expires_after' => now()->copy()->addYear(),
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting', 'live_slideshow'],
                'paddle_product_id' => 'pro_01k8jcxt7gc6g6ddavmq65txzz',
                'paddle_price_id' => 'pri_01k8jcxtfa07gvq43kpvpe0t8z',
                'description' => <<<TEXT
Ideal für Agenturen, Fotografen oder Eventdienstleister mit vielen Veranstaltungen im Jahr. {{max_events_per_year}} Events inklusive, White-Label-Branding und alle Premium-Funktionen sorgen für maximale Flexibilität.
TEXT,
                'description_translations' => [
                    'de' => 'Ideal für Agenturen, Fotografen oder Eventdienstleister mit vielen Veranstaltungen im Jahr. {{max_events_per_year}} Events inklusive, White-Label-Branding und alle Premium-Funktionen sorgen für maximale Flexibilität.',
                    'en' => 'Ideal for agencies, photographers or event providers with a packed calendar. {{max_events_per_year}} events included, white-label branding and all premium features for maximum flexibility.',
                ],
                'description_table' => [
                    ['title' => 'Events/Jahr', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Branding', 'value' => 'White-Label & eigene Domains'],
                    ['title' => 'Extras', 'value' => 'Live-Slideshow & Premium-Features'],
                ],
            ],
            [
                'slug' => 'studio-annual',
                'name' => 'Studio Jahrespaket',
                'name_translations' => [
                    'de' => 'Studio Jahrespaket',
                    'en' => 'Studio Annual',
                ],
                'type' => PackageType::RESELLER,
                'price' => 1299.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => false,
                'max_events_per_year' => 24,
                'expires_after' => null,
                'features' => ['basic_uploads', 'unlimited_sharing', 'custom_branding'],
                'paddle_product_id' => 'pro_01k8jct3gz9ks5mg6z61q6nrxb',
                'paddle_price_id' => 'pri_01k8jcxsa8axwpjnybhjbcrb06',
                'description' => null,
                'description_translations' => null,
                'description_table' => [],
            ],
            [
                'slug' => 'enterprise-unlimited',
                'name' => 'Enterprise / Unlimited',
                'name_translations' => [
                    'de' => 'Enterprise / Unlimited',
                    'en' => 'Enterprise / Unlimited',
                ],
                'type' => PackageType::RESELLER,
                'price' => 1999.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => false,
                'branding_allowed' => true,
                'max_events_per_year' => null,
                'expires_after' => now()->copy()->addYear(),
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting', 'live_slideshow', 'unlimited_sharing'],
                'description' => <<<TEXT
Das Rundum-Paket für Unternehmen und Agenturen, die maximale Flexibilität brauchen. {{max_events_per_year}} Events, volles White-Label-Branding, eigene Subdomain oder App-Branding – alles individuell anpassbar, inklusive persönlicher Betreuung.
TEXT,
                'description_translations' => [
                    'de' => 'Das Rundum-Paket für Unternehmen und Agenturen, die maximale Flexibilität brauchen. {{max_events_per_year}} Events, volles White-Label-Branding, eigene Subdomain oder App-Branding – alles individuell anpassbar, inklusive persönlicher Betreuung.',
                    'en' => 'The all-round package for enterprises and agencies needing maximum flexibility. {{max_events_per_year}} events, full white-label branding, your own subdomain or app branding—fully customisable with dedicated support.',
                ],
                'description_table' => [
                    ['title' => 'Events/Jahr', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Branding', 'value' => 'Eigene Subdomain oder App'],
                    ['title' => 'Support', 'value' => 'Persönliche Betreuung'],
                ],
            ],
        ];

        foreach ($packages as $data) {
            $descriptionTable = $data['description_table'] ?? [];
            Package::updateOrCreate(
                ['slug' => $data['slug']],
                array_merge($data, [
                    'description_table' => $descriptionTable,
                ])
            );
        }
    }
}
