<?php

namespace Database\Seeders;

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

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' => 600,
                'max_guests' => 100,
                'gallery_days' => 180,
                'max_tasks' => 30,
                'max_events_per_year' => 1,
                'watermark_allowed' => false,
                'branding_allowed' => false,
                'features' => ['basic_uploads', 'limited_sharing', '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' => 4000,
                'max_guests' => 250,
                'gallery_days' => 365,
                'max_tasks' => 100,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'features' => ['basic_uploads', 'unlimited_sharing', 'custom_branding', 'custom_tasks', 'live_slideshow', 'no_watermark'],
                '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 & Live-Slideshow'],
                ],
            ],
            [
                'slug' => 'pro',
                'name' => 'Premium',
                'name_translations' => [
                    'de' => 'Premium',
                    'en' => 'Premium',
                ],
                'type' => PackageType::ENDCUSTOMER,
                'price' => 119.00,
                'max_photos' => 10000,
                'max_guests' => null,
                'gallery_days' => 730,
                'max_tasks' => 200,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'features' => ['basic_uploads', 'unlimited_sharing', 'custom_branding', 'custom_tasks', 'live_slideshow', 'advanced_analytics', '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, unbegrenzt viele Gäste, {{gallery_duration}} Galerie-Zugang und {{max_tasks}} Aufgaben – dazu eigenes Wasserzeichen, Live-Slideshow und Premium-Support.
TEXT,
                'description_translations' => [
                    'de' => 'Das volle Erlebnis für alle, die keine Kompromisse machen wollen. {{max_photos}} Bilder, unbegrenzt viele Gäste, {{gallery_duration}} Galerie-Zugang und {{max_tasks}} Aufgaben – dazu eigenes Wasserzeichen, Live-Slideshow und Premium-Support.',
                    'en' => 'The full experience for anyone who refuses to compromise. {{max_photos}} photos, unlimited guests, {{gallery_duration}} of gallery access and {{max_tasks}} challenges—custom watermark, live slideshow and premium support included.',
                ],
                'description_table' => [
                    ['title' => 'Fotos', 'value' => '{{max_photos}}'],
                    ['title' => 'Gäste', 'value' => 'Unbegrenzt'],
                    ['title' => 'Aufgaben', 'value' => '{{max_tasks}} Fotoaufgaben'],
                    ['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
                    ['title' => 'Extras', 'value' => 'Live-Slideshow & Premium-Support'],
                ],
            ],
            [
                'slug' => 's-small-reseller',
                'name' => 'Partner Start',
                'name_translations' => [
                    'de' => 'Partner Start',
                    'en' => 'Partner Start',
                ],
                'type' => PackageType::RESELLER,
                'included_package_slug' => 'starter',
                'price' => 149.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 5,
                'expires_after' => null,
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support'],
                'paddle_product_id' => 'pro_01k8jcxvax48mhmwsfydw8ha9y',
                'paddle_price_id' => 'pri_01k8jcxvhe0bfasg9gg1rw70sy',
                'description' => <<<'TEXT'
Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Starter‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.
TEXT,
                'description_translations' => [
                    'de' => 'Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Starter‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.',
                    'en' => 'Event-Kontingent for Partner / Agencies: {{max_events_per_year}} events at Starter level. Recommended to use within 24 months.',
                ],
                'description_table' => [
                    ['title' => 'Events', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Inklusive Event-Level', 'value' => 'Starter'],
                    ['title' => 'Empfehlung', 'value' => 'Empfohlen innerhalb von 24 Monaten zu nutzen.'],
                ],
            ],
            [
                'slug' => 'm-medium-reseller',
                'name' => 'Partner Standard',
                'name_translations' => [
                    'de' => 'Partner Standard',
                    'en' => 'Partner Standard',
                ],
                'type' => PackageType::RESELLER,
                'included_package_slug' => 'standard',
                'price' => 349.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 15,
                'expires_after' => null,
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting'],
                'paddle_product_id' => 'pro_01k8jcxtrxw7jsew52jnax901q',
                'paddle_price_id' => 'pri_01k8jcxv06nsgy8ym8mnfrfm5v',
                'description' => <<<'TEXT'
Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Standard‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.
TEXT,
                'description_translations' => [
                    'de' => 'Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Standard‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.',
                    'en' => 'Event-Kontingent for Partner / Agencies: {{max_events_per_year}} events at Standard level. Recommended to use within 24 months.',
                ],
                'description_table' => [
                    ['title' => 'Events', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Inklusive Event-Level', 'value' => 'Standard'],
                    ['title' => 'Empfehlung', 'value' => 'Empfohlen innerhalb von 24 Monaten zu nutzen.'],
                ],
            ],
            [
                'slug' => 'l-large-reseller',
                'name' => 'Partner Premium',
                'name_translations' => [
                    'de' => 'Partner Premium',
                    'en' => 'Partner Premium',
                ],
                'type' => PackageType::RESELLER,
                'included_package_slug' => 'pro',
                'price' => 1999.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 35,
                'expires_after' => null,
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting', 'live_slideshow'],
                'paddle_product_id' => 'pro_01k8jcxt7gc6g6ddavmq65txzz',
                'paddle_price_id' => 'pri_01k8jcxtfa07gvq43kpvpe0t8z',
                'description' => <<<'TEXT'
Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Premium‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.
TEXT,
                'description_translations' => [
                    'de' => 'Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Premium‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.',
                    'en' => 'Event-Kontingent for Partner / Agencies: {{max_events_per_year}} events at Premium level. Recommended to use within 24 months.',
                ],
                'description_table' => [
                    ['title' => 'Events', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Inklusive Event-Level', 'value' => 'Premium'],
                    ['title' => 'Empfehlung', 'value' => 'Empfohlen innerhalb von 24 Monaten zu nutzen.'],
                ],
            ],
            [
                'slug' => 'partner-premium-5',
                'name' => 'Partner Premium-Kontingent (5 Events)',
                'name_translations' => [
                    'de' => 'Partner Premium-Kontingent (5 Events)',
                    'en' => 'Partner Premium kontingent (5 events)',
                ],
                'type' => PackageType::RESELLER,
                'included_package_slug' => 'pro',
                'price' => 549.00,
                'max_photos' => null,
                'max_guests' => null,
                'gallery_days' => null,
                'max_tasks' => null,
                'watermark_allowed' => true,
                'branding_allowed' => true,
                'max_events_per_year' => 5,
                'expires_after' => null,
                'features' => ['reseller_dashboard', 'custom_branding', 'priority_support'],
                'paddle_product_id' => 'pro_01kf16ttp0fph79j59x0z1cdqc',
                'paddle_price_id' => 'pri_01kf16v0v2z4hse5cxq5wnah4b',
                'description' => <<<'TEXT'
Premium Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Premium‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.
TEXT,
                'description_translations' => [
                    'de' => 'Premium Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Premium‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.',
                    'en' => 'Premium Event-Kontingent for Partner / Agencies: {{max_events_per_year}} events at Premium level. Recommended to use within 24 months.',
                ],
                'description_table' => [
                    ['title' => 'Events', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Inklusive Event-Level', 'value' => 'Premium'],
                    ['title' => 'Empfehlung', 'value' => 'Empfohlen innerhalb von 24 Monaten zu nutzen.'],
                ],
            ],
            [
                'slug' => 'studio-annual',
                'name' => 'Partner Jahreskontingent (24 Events)',
                'name_translations' => [
                    'de' => 'Partner Jahreskontingent (24 Events)',
                    'en' => 'Partner annual kontingent (24 events)',
                ],
                'type' => PackageType::RESELLER,
                'included_package_slug' => 'standard',
                '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' => ['reseller_dashboard', 'custom_branding', 'priority_support', 'advanced_reporting'],
                'paddle_product_id' => 'pro_01k8jct3gz9ks5mg6z61q6nrxb',
                'paddle_price_id' => 'pri_01k8jcxsa8axwpjnybhjbcrb06',
                'description' => <<<'TEXT'
Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Standard‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.
TEXT,
                'description_translations' => [
                    'de' => 'Event-Kontingent für Partner / Agenturen: {{max_events_per_year}} Events auf Standard‑Niveau. Empfohlen innerhalb von 24 Monaten zu nutzen.',
                    'en' => 'Event-Kontingent for Partner / Agencies: {{max_events_per_year}} events at Standard level. Recommended to use within 24 months.',
                ],
                'description_table' => [
                    ['title' => 'Events', 'value' => '{{max_events_per_year}} Events'],
                    ['title' => 'Inklusive Event-Level', 'value' => 'Standard'],
                    ['title' => 'Empfehlung', 'value' => 'Empfohlen innerhalb von 24 Monaten zu nutzen.'],
                ],
            ],
        ];

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

        Package::where('slug', 'enterprise-unlimited')->delete();
    }
}
