<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ExtendCategoryTranslationsSeeder extends Seeder
{
    /**
     * Run to extend the SiteContents category translations without refreshing the database.
     * Usage:
     * Step 1: php artisan db:seed --class=ExtendCategoriesSeeder
     * Step 2: php artisan db:seed --class=ExtendCategoryTranslationsSeeder
     *
     */
    public function run(): void
    {
        $translations = [
            'SiteContents\\Static\\OpenSource' => [
                'en' => ['name' => 'Open source page', 'slug' => 'open-source-page'],
                'nl' => ['name' => 'Open source pagina', 'slug' => 'open-source-pagina'],
                'de' => ['name' => 'Open Source Seite', 'slug' => 'open-source-seite'],
                'es' => ['name' => 'Página código abierto', 'slug' => 'pagina-codigo-abierto'],
                'fr' => ['name' => 'Page open source', 'slug' => 'page-open-source'],
            ],
            'SiteContents\\Static\\WhyJoin' => [
                'en' => ['name' => 'Why join page', 'slug' => 'why-join-page'],
                'nl' => ['name' => 'Waarom meedoen-pagina', 'slug' => 'waarom-meedoen-pagina'],
                'de' => ['name' => 'Warum mitmachen Seite', 'slug' => 'warum-mitmachen-seite'],
                'es' => ['name' => 'Por qué participar página', 'slug' => 'Por-que-participar-página'],
                'fr' => ['name' => 'Pourquoi participer page', 'slug' => 'pourquoi-participer-page'],
            ],
            'SiteContents\\Search\\Info' => [
                'en' => ['name' => 'Search info page', 'slug' => 'search-info-page'],
                'nl' => ['name' => 'Zoek info pagina', 'slug' => 'zoek-info-pagina'],
                'de' => ['name' => 'Such-Info Seite', 'slug' => 'such-info-seite'],
                'es' => ['name' => 'Página de información de búsqueda', 'slug' => 'pagina-de-informacion-de-busqueda'],
                'fr' => ['name' => 'Page d\'information de recherche', 'slug' => 'page-d-information-de-recherche'],
            ],
            'SiteContents\\AccountUsage\\Info' => [
                'en' => ['name' => 'Account usage info page', 'slug' => 'account-usage-info-page'],
                'nl' => ['name' => 'Accountgebruik info pagina', 'slug' => 'accountgebruik-info-pagina'],
                'de' => ['name' => 'Kontonutzung Seite', 'slug' => 'kontonutzung-seite'],
                'es' => ['name' => 'Uso de cuenta página', 'slug' => 'uso-de-cuenta-pagina'],
                'fr' => ['name' => 'Utilisation du compte page', 'slug' => 'utilisation-du-compte-page'],
            ],
            'SiteContents\\Contacts' => [
                'en' => ['name' => 'Contacts', 'slug' => 'contacts'],
                'nl' => ['name' => 'Contacten', 'slug' => 'contacten'],
                'de' => ['name' => 'Kontakte', 'slug' => 'kontakte'],
                'es' => ['name' => 'Contactos', 'slug' => 'contactos'],
                'fr' => ['name' => 'Contacts', 'slug' => 'fr-contacts'],
            ],
            'SiteContents\\Manage\\CallsAdmin' => [
                'en' => ['name' => 'Calls admin page', 'slug' => 'calls-admin-page'],
                'nl' => ['name' => 'Oproepen beheerpagina', 'slug' => 'oproepen-beheerpagina'],
                'de' => ['name' => 'Aufrufe Adminseite', 'slug' => 'aufrufe-adminseite'],
                'es' => ['name' => 'Página admin llamadas', 'slug' => 'pagina-admin-llamadas'],
                'fr' => ['name' => 'Page admin appels', 'slug' => 'page-admin-appels'],
            ],
            'SiteContents\\Manage\\Calls' => [
                'en' => ['name' => 'Calls page', 'slug' => 'calls-page'],
                'nl' => ['name' => 'Oproepen-pagina', 'slug' => 'oproepen-pagina'],
                'de' => ['name' => 'Aufrufe Seite', 'slug' => 'aufrufe-seite'],
                'es' => ['name' => 'Llamadas-página', 'slug' => 'llamadas-pagina'],
                'fr' => ['name' => 'Appels-page', 'slug' => 'appels-page'],
            ],
            'SiteContents\\Manage\\Posts' => [
                'en' => ['name' => 'Posts page', 'slug' => 'posts-page'],
                'nl' => ['name' => 'Artikelen-pagina', 'slug' => 'artikelen-pagina'],
                'de' => ['name' => 'Beiträge Seite', 'slug' => 'beiträge-seite'],
                'es' => ['name' => 'Publicaciones-página', 'slug' => 'publicaciones-página'],
                'fr' => ['name' => 'Articles-page', 'slug' => 'articles-page'],
            ],
            'SiteContents\\Manage\\Categories' => [
                'en' => ['name' => 'Categories page', 'slug' => 'categories-page'],
                'nl' => ['name' => 'Categorieën-pagina', 'slug' => 'categorieën-pagina'],
                'de' => ['name' => 'Kategorien Seite', 'slug' => 'kategorien-seite'],
                'es' => ['name' => 'Categorías-página', 'slug' => 'categorías-página'],
                'fr' => ['name' => 'Catégories-page', 'slug' => 'fr-categories-page'],
            ],
            'SiteContents\\Manage\\Tags' => [
                'en' => ['name' => 'Tags page', 'slug' => 'tags-page'],
                'nl' => ['name' => 'Labels pagina', 'slug' => 'labels-pagina'],
                'de' => ['name' => 'Tags Seite', 'slug' => 'tags-seite'],
                'es' => ['name' => 'Etiquetas-página', 'slug' => 'etiquetas-página'],
                'fr' => ['name' => 'Étiquettes-page', 'slug' => 'étiquettes-page'],
            ],
            'SiteContents\\Manage\\Profiles' => [
                'en' => ['name' => 'Profiles page', 'slug' => 'profiles-page'],
                'nl' => ['name' => 'Profielen-pagina', 'slug' => 'profielen-pagina'],
                'de' => ['name' => 'Profile Seite', 'slug' => 'profile-seite'],
                'es' => ['name' => 'Perfiles-página', 'slug' => 'perfiles-página'],
                'fr' => ['name' => 'Profils-page', 'slug' => 'profils-page'],
            ],
            'SiteContents\\Manage\\Permissions' => [
                'en' => ['name' => 'Permissions page', 'slug' => 'permissions-page'],
                'nl' => ['name' => 'Rechten-pagina', 'slug' => 'rechten-pagina'],
                'de' => ['name' => 'Berechtigungen Seite', 'slug' => 'berechtigungen-seite'],
                'es' => ['name' => 'Permisos-página', 'slug' => 'permisos-página'],
                'fr' => ['name' => 'Permissions page', 'slug' => 'fr-permissions-page'],
            ],
            'SiteContents\\Manage\\Roles' => [
                'en' => ['name' => 'Roles page', 'slug' => 'roles-page'],
                'nl' => ['name' => 'Rollen-pagina', 'slug' => 'rollen-pagina'],
                'de' => ['name' => 'Rollen Seite', 'slug' => 'rollen-seite'],
                'es' => ['name' => 'Roles-página', 'slug' => 'roles-página'],
                'fr' => ['name' => 'Rôles-page', 'slug' => 'fr-roles-page'],
            ],
            'SiteContents\\Messenger\\Announcement' => [
                'en' => ['name' => 'Messenger Announcement', 'slug' => 'messenger-announcement'],
                'nl' => ['name' => 'Messenger aankondiging', 'slug' => 'messenger-aankondiging'],
                'de' => ['name' => 'Messenger Ankündigung', 'slug' => 'messenger-ankündigung'],
                'es' => ['name' => 'Anuncio mensajero', 'slug' => 'anuncio-mensajero'],
                'fr' => ['name' => 'Annonce messager', 'slug' => 'annonce-messager'],
            ],
            'SiteContents\\Terms' => [
                'en' => ['name' => 'Terms of Service', 'slug' => 'terms-of-service'],
                'nl' => ['name' => 'Algemene voorwaarden', 'slug' => 'algemene-voorwaarden'],
                'de' => ['name' => 'Nutzungsbedingungen', 'slug' => 'nutzungsbedingungen'],
                'es' => ['name' => 'Términos de servicio', 'slug' => 'terminos-de-servicio'],
                'fr' => ['name' => 'Conditions d\'utilisation', 'slug' => 'conditions-d-utilisation'],
            ],
            'SiteContents\\PrivacyPolicy' => [
                'en' => ['name' => 'Privacy Policy', 'slug' => 'privacy-policy'],
                'nl' => ['name' => 'Privacybeleid', 'slug' => 'privacybeleid'],
                'de' => ['name' => 'Datenschutzrichtlinie', 'slug' => 'datenschutzrichtlinie'],
                'es' => ['name' => 'Política de privacidad', 'slug' => 'politica-de-privacidad'],
                'fr' => ['name' => 'Politique de confidentialité', 'slug' => 'politique-de-confidentialite'],
            ],
            'SiteContents\\Search\\Hints' => [
                'en' => ['name' => 'Search hints page', 'slug' => 'search-hints-page'],
                'nl' => ['name' => 'Zoektips pagina', 'slug' => 'zoektips-pagina'],
                'de' => ['name' => 'Suchhinweise Seite', 'slug' => 'suchhinweise-seite'],
                'es' => ['name' => 'Consejos de búsqueda página', 'slug' => 'consejos-de-busqueda-pagina'],
                'fr' => ['name' => 'Conseils de recherche page', 'slug' => 'conseils-de-recherche-page'],
            ],
            'SiteContents\\Search\\NoResults' => [
                'en' => ['name' => 'Search no results page', 'slug' => 'search-no-results-page'],
                'nl' => ['name' => 'Zoeken geen resultaten pagina', 'slug' => 'zoeken-geen-resultaten-pagina'],
                'de' => ['name' => 'Suche keine Ergebnisse Seite', 'slug' => 'suche-keine-ergebnisse-seite'],
                'es' => ['name' => 'Búsqueda sin resultados página', 'slug' => 'busqueda-sin-resultados-pagina'],
                'fr' => ['name' => 'Recherche sans résultats page', 'slug' => 'recherche-sans-resultats-page'],
            ],
            'SiteContents\\Errors\\503' => [
                'en' => ['name' => 'Service Unavailable page', 'slug' => 'error-503-service-unavailable-page'],
                'nl' => ['name' => 'Service niet beschikbaar pagina', 'slug' => 'fout-503-service-niet-beschikbaar-pagina'],
                'de' => ['name' => 'Dienst nicht verfügbar Seite', 'slug' => 'fehler-503-dienst-nicht-verfugbar-seite'],
                'es' => ['name' => 'Servicio no disponible página', 'slug' => 'error-503-servicio-no-disponible-pagina'],
                'fr' => ['name' => 'Service indisponible page', 'slug' => 'erreur-503-service-indisponible-page'],
            ],
            'SiteContents\\Errors\\500' => [
                'en' => ['name' => 'Internal Server Error page', 'slug' => 'error-500-internal-server-error-page'],
                'nl' => ['name' => 'Interne serverfout pagina', 'slug' => 'fout-500-interne-serverfout-pagina'],
                'de' => ['name' => 'Interner Serverfehler Seite', 'slug' => 'fehler-500-interner-serverfehler-seite'],
                'es' => ['name' => 'Error interno del servidor página', 'slug' => 'error-500-error-interno-del-servidor-pagina'],
                'fr' => ['name' => 'Erreur interne du serveur page', 'slug' => 'erreur-500-erreur-interne-du-serveur-page'],
            ],
            'SiteContents\\Errors\\429' => [
                'en' => ['name' => 'Too Many Requests page', 'slug' => 'error-429-too-many-requests-page'],
                'nl' => ['name' => 'Te veel verzoeken pagina', 'slug' => 'fout-429-te-veel-verzoeken-pagina'],
                'de' => ['name' => 'Zu viele Anfragen Seite', 'slug' => 'fehler-429-zu-viele-anfragen-seite'],
                'es' => ['name' => 'Demasiadas solicitudes página', 'slug' => 'error-429-demasiadas-solicitudes'],
                'fr' => ['name' => 'Trop de demandes page', 'slug' => 'erreur-429-trop-de-demandes-page'],
            ],
            'SiteContents\\Errors\\419' => [
                'en' => ['name' => 'Page Expired page', 'slug' => 'error-419-page-expired-page'],
                'nl' => ['name' => 'Pagina verlopen pagina', 'slug' => 'fout-419-pagina-verlopen-pagina'],
                'de' => ['name' => 'Seite abgelaufen Seite', 'slug' => 'fehler-419-seite-abgelaufen-seite'],
                'es' => ['name' => 'Página expirada página', 'slug' => 'error-419-pagina-expirada-pagina'],
                'fr' => ['name' => 'Page expirée page', 'slug' => 'erreur-419-page-expiree-page'],
            ],
            'SiteContents\\Errors\\404' => [
                'en' => ['name' => 'Not Found page', 'slug' => 'error-404-not-found-page'],
                'nl' => ['name' => 'Niet gevonden pagina', 'slug' => 'fout-404-niet-gevonden-pagina'],
                'de' => ['name' => 'Nicht gefunden Seite', 'slug' => 'fehler-404-nicht-gefunden-seite'],
                'es' => ['name' => 'No encontrado página', 'slug' => 'error-404-no-encontrado-pagina'],
                'fr' => ['name' => 'Non trouvé page', 'slug' => 'erreur-404-non-trouve-page'],
            ],
            'SiteContents\\Errors\\403' => [
                'en' => ['name' => 'Forbidden page', 'slug' => 'error-403-forbidden-page'],
                'nl' => ['name' => 'Verboden pagina', 'slug' => 'fout-403-verboden-pagina'],
                'de' => ['name' => 'Verboten Seite', 'slug' => 'fehler-403-verboten-seite'],
                'es' => ['name' => 'Prohibido página', 'slug' => 'error-403-prohibido-pagina'],
                'fr' => ['name' => 'Interdit page', 'slug' => 'erreur-403-interdit-page'],
            ],
            'SiteContents\\Errors\\402' => [
                'en' => ['name' => 'Payment Required page', 'slug' => 'error-402-payment-required-page'],
                'nl' => ['name' => 'Betaling vereist pagina', 'slug' => 'fout-402-betaling-vereist-pagina'],
                'de' => ['name' => 'Bezahlung erforderlich Seite', 'slug' => 'fehler-402-bezahlung-erforderlich-seite'],
                'es' => ['name' => 'Pago requerido página', 'slug' => 'error-402-pago-requerido-pagina'],
                'fr' => ['name' => 'Paiement requis page', 'slug' => 'erreur-402-paiement-requis-page'],
            ],
            'SiteContents\\Errors\\401' => [
                'en' => ['name' => 'Unauthorized page', 'slug' => 'error-401-unauthorized-page'],
                'nl' => ['name' => 'Niet geautoriseerd pagina', 'slug' => 'fout-401-niet-geautoriseerd-pagina'],
                'de' => ['name' => 'Nicht autorisiert Seite', 'slug' => 'fehler-401-nicht-autorisiert-seite'],
                'es' => ['name' => 'No autorizado página', 'slug' => 'error-401-no-autorizado-pagina'],
                'fr' => ['name' => 'Non autorisé page', 'slug' => 'erreur-401-non-autorise-page'],
            ],
            'SiteContents\\Report\\Error' => [
                'en' => ['name' => 'Report an error page', 'slug' => 'report-error-page'],
                'nl' => ['name' => 'Een fout melden pagina', 'slug' => 'fout-melden-pagina'],
                'de' => ['name' => 'Einen Fehler melden Seite', 'slug' => 'fehler-melden-seite'],
                'es' => ['name' => 'Reportar un error página', 'slug' => 'reportar-un-error-pagina'],
                'fr' => ['name' => 'Signaler une erreur page', 'slug' => 'signaler-une-erreur-page'],
            ],
            'SiteContents\\Report\\Issue' => [
                'en' => ['name' => 'Report an issue page', 'slug' => 'report-issue-page'],
                'nl' => ['name' => 'Meld een probleem pagina', 'slug' => 'meld-probleem-pagina'],
                'de' => ['name' => 'Ein Problem melden', 'slug' => 'problem-melden-seite'],
                'es' => ['name' => 'Reportar un problema página', 'slug' => 'reportar-un-problema-pagina'],
                'fr' => ['name' => 'Signaler un problème page', 'slug' => 'signaler-un-probleme-page'],
            ],
            'SiteContents\\MaintenanceAnnouncement' => [
                'en' => ['name' => 'Maintenance-announcement', 'slug' => 'maintenance-announcement'],
                'nl' => ['name' => 'Onderhoudsmelding', 'slug' => 'onderhoudsmelding'],
                'de' => ['name' => 'Wartungsankündigung', 'slug' => 'wartungsankundigung'],
                'es' => ['name' => 'Aviso de mantenimiento', 'slug' => 'aviso-de-mantenimiento'],
                'fr' => ['name' => 'Annonce de maintenance', 'slug' => 'annonce-de-maintenance'],
            ],
            'SiteContents\\ProfileIncomplete' => [
                'en' => ['name' => 'Profile Incomplete Warning', 'slug' => 'profile-incomplete-warning'],
                'nl' => ['name' => 'Profiel Incompleet Waarschuwing', 'slug' => 'profiel-incompleet-waarschuwing'],
                'de' => ['name' => 'Unvollständiges Profil Warnung', 'slug' => 'unvollstandiges-profil-warnung'],
                'es' => ['name' => 'Advertencia de Perfil Incompleto', 'slug' => 'advertencia-de-perfil-incompleto'],
                'fr' => ['name' => 'Avertissement Profil Incomplet', 'slug' => 'avertissement-profil-incomplet'],
            ],
            'SiteContents\\Call\\NotAllowed' => [
                'en' => ['name' => 'Call not allowed', 'slug' => 'call-not-allowed'],
                'nl' => ['name' => 'Oproep niet toegestaan', 'slug' => 'oproep-niet-toegestaan'],
                'de' => ['name' => 'Anruf nicht erlaubt', 'slug' => 'anruf-nicht-erlaubt'],
                'es' => ['name' => 'Llamada no permitida', 'slug' => 'llamada-no-permitida'],
                'fr' => ['name' => 'Appel non autorisé', 'slug' => 'appel-non-autorise'],
            ],
            'App\\Models\\ImagePost' => [
                'en' => ['name' => 'Image', 'slug' => 'image'],
                'nl' => ['name' => 'Beeld', 'slug' => 'beeld'],
                'de' => ['name' => 'Bild', 'slug' => 'bild'],
                'es' => ['name' => 'Imagen', 'slug' => 'imagen'],
                'fr' => ['name' => 'Image', 'slug' => 'image-fr'],
            ],
            'App\\Models\\ImagePost\\en' => [
                'en' => ['name' => 'Image - English', 'slug' => 'image-english'],
                'nl' => ['name' => 'Beeld - Engels', 'slug' => 'beeld-engels'],
                'de' => ['name' => 'Bild - Englisch', 'slug' => 'bild-englisch'],
                'es' => ['name' => 'Imagen - Inglés', 'slug' => 'imagen-ingles'],
                'fr' => ['name' => 'Image - Anglais', 'slug' => 'image-anglais'],
            ],
            'App\\Models\\ImagePost\\fr' => [
                'en' => ['name' => 'Image - French', 'slug' => 'image-french'],
                'nl' => ['name' => 'Beeld - Frans', 'slug' => 'beeld-frans'],
                'de' => ['name' => 'Bild - Französisch', 'slug' => 'bild-franzosisch'],
                'es' => ['name' => 'Imagen - Francés', 'slug' => 'imagen-frances'],
                'fr' => ['name' => 'Image - Français', 'slug' => 'image-francais'],
            ],
            'App\\Models\\ImagePost\\nl' => [
                'en' => ['name' => 'Image - Dutch', 'slug' => 'image-dutch'],
                'nl' => ['name' => 'Beeld - Nederlands', 'slug' => 'beeld-nederlands'],
                'de' => ['name' => 'Bild - Niederländisch', 'slug' => 'bild-niederlandisch'],
                'es' => ['name' => 'Imagen - Holandés', 'slug' => 'imagen-holandes'],
                'fr' => ['name' => 'Image - Néerlandais', 'slug' => 'image-neerlandais'],
            ],
            'App\\Models\\ImagePost\\es' => [
                'en' => ['name' => 'Image - Spanish', 'slug' => 'image-spanish'],
                'nl' => ['name' => 'Beeld - Spaans', 'slug' => 'beeld-spaans'],
                'de' => ['name' => 'Bild - Spanisch', 'slug' => 'bild-spanisch'],
                'es' => ['name' => 'Imagen - Español', 'slug' => 'imagen-espanol'],
                'fr' => ['name' => 'Image - Espagnol', 'slug' => 'image-espagnol'],
            ],
            'App\\Models\\ImagePost\\de' => [
                'en' => ['name' => 'Image - German', 'slug' => 'image-german'],
                'nl' => ['name' => 'Beeld - Duits', 'slug' => 'beeld-duits'],
                'de' => ['name' => 'Bild - Deutsch', 'slug' => 'bild-deutsch'],
                'es' => ['name' => 'Imagen - Alemán', 'slug' => 'imagen-aleman'],
                'fr' => ['name' => 'Image - Allemand', 'slug' => 'image-allemand'],
            ],
        ];

        foreach ($translations as $type => $locales) {
            $category = DB::table('categories')->where('type', $type)->first();

            if ($category) {
                foreach ($locales as $locale => $translation) {
                    $exists = DB::table('category_translations')
                        ->where('category_id', $category->id)
                        ->where('locale', $locale)
                        ->exists();

                    if (!$exists) {
                        DB::table('category_translations')->insert([
                            'category_id' => $category->id,
                            'locale' => $locale,
                            'slug' => $translation['slug'],
                            'name' => $translation['name'],
                            'created_at' => now(),
                            'updated_at' => now(),
                        ]);
                    }
                }
            }
        }
    }
}
