<?php

namespace Database\Seeders;

use App\Models\Setting;
use Illuminate\Database\Seeder;

class SettingSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $settings = [
            // General Settings
            [
                'key' => 'site_name',
                'value' => 'Pet Adoption Center',
                'type' => 'string',
                'group' => 'general',
                'description' => 'The name of the website',
            ],
            [
                'key' => 'site_tagline',
                'value' => 'Find your perfect companion',
                'type' => 'string',
                'group' => 'general',
                'description' => 'The tagline or slogan for the website',
            ],
            [
                'key' => 'site_description',
                'value' => 'We help connect loving families with pets in need of homes.',
                'type' => 'string',
                'group' => 'general',
                'description' => 'A brief description of the website',
            ],
            [
                'key' => 'site_logo',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the site logo',
            ],
            [
                'key' => 'header_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the header background image',
            ],
            [
                'key' => 'middle_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the middle section background image',
            ],
            [
                'key' => 'footer_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the footer background image',
            ],
            [
                'key' => 'application_form_header_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the application form header background image',
            ],
            [
                'key' => 'pets_page_header_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the pets page header background image',
            ],
            [
                'key' => 'blog_header_image',
                'value' => null,
                'type' => 'string',
                'group' => 'general',
                'description' => 'Path to the blog page header background image',
            ],
            [
                'key' => 'default_timezone',
                'value' => 'America/Toronto',
                'type' => 'string',
                'group' => 'general',
                'description' => 'Default timezone for the application',
            ],

            // SEO Settings
            [
                'key' => 'seo_title',
                'value' => 'Pet Adoption Center - Find Your Perfect Companion',
                'type' => 'string',
                'group' => 'seo',
                'description' => 'Default SEO title for the website',
            ],
            [
                'key' => 'seo_description',
                'value' => 'Browse our selection of adorable pets looking for loving homes. Adopt a dog, cat, or other pet today.',
                'type' => 'string',
                'group' => 'seo',
                'description' => 'Default SEO meta description',
            ],
            [
                'key' => 'seo_keywords',
                'value' => 'pet adoption, adopt a dog, adopt a cat, animal rescue, pet shelter',
                'type' => 'string',
                'group' => 'seo',
                'description' => 'Default SEO keywords',
            ],

            // Contact Settings
            [
                'key' => 'contact_email',
                'value' => 'info@petadoption.test',
                'type' => 'string',
                'group' => 'contact',
                'description' => 'Primary contact email address',
            ],
            [
                'key' => 'contact_phone',
                'value' => null,
                'type' => 'string',
                'group' => 'contact',
                'description' => 'Primary contact phone number',
            ],
            [
                'key' => 'contact_address',
                'value' => null,
                'type' => 'string',
                'group' => 'contact',
                'description' => 'Physical address of the organization',
            ],

            // Social Media Settings
            [
                'key' => 'social_facebook',
                'value' => null,
                'type' => 'string',
                'group' => 'social',
                'description' => 'Facebook page URL',
            ],
            [
                'key' => 'social_twitter',
                'value' => null,
                'type' => 'string',
                'group' => 'social',
                'description' => 'Twitter/X profile URL',
            ],
            [
                'key' => 'social_instagram',
                'value' => null,
                'type' => 'string',
                'group' => 'social',
                'description' => 'Instagram profile URL',
            ],
            [
                'key' => 'social_youtube',
                'value' => null,
                'type' => 'string',
                'group' => 'social',
                'description' => 'YouTube channel URL',
            ],
            [
                'key' => 'social_linkedin',
                'value' => null,
                'type' => 'string',
                'group' => 'social',
                'description' => 'LinkedIn profile URL',
            ],

            // Application Settings
            [
                'key' => 'enable_draws',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Enable or disable 50/50 draws',
            ],
            [
                'key' => 'enable_memberships',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Enable or disable memberships',
            ],
            [
                'key' => 'enable_foster_applications',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Enable or disable foster application submissions',
            ],
            [
                'key' => 'enable_assistance_applications',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Enable or disable assistance application submissions',
            ],
            [
                'key' => 'max_active_adoption_applications',
                'value' => '2',
                'type' => 'integer',
                'group' => 'application',
                'description' => 'Maximum number of active (non-archived) adoption applications per user',
            ],
            [
                'key' => 'max_active_assistance_applications',
                'value' => '2',
                'type' => 'integer',
                'group' => 'application',
                'description' => 'Maximum number of active (non-archived) assistance applications per user',
            ],
            [
                'key' => 'view_submissions_online',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Allow users to view their application submissions online on the dashboard',
            ],
            [
                'key' => 'require_auth_for_adoption_applications',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Require authentication to submit adoption applications',
            ],
            [
                'key' => 'require_auth_for_fostering_applications',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Require authentication to submit fostering applications',
            ],
            [
                'key' => 'require_auth_for_assistance_applications',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'application',
                'description' => 'Require authentication to submit assistance applications',
            ],

            // Communication Settings
            [
                'key' => 'email_welcome_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send welcome email after user email verification',
            ],
            [
                'key' => 'email_adoption_application_received_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send confirmation email when adoption application is received',
            ],
            [
                'key' => 'email_fostering_application_received_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send confirmation email when fostering application is received',
            ],
            [
                'key' => 'email_assistance_application_received_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send confirmation email when assistance application is received',
            ],
            [
                'key' => 'email_interview_scheduled_enabled',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when interview is scheduled',
            ],
            [
                'key' => 'email_interview_rescheduled_enabled',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when interview is rescheduled',
            ],
            [
                'key' => 'email_interview_scheduled_admin_enabled',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send admin email when interview is scheduled',
            ],
            [
                'key' => 'email_interview_rescheduled_admin_enabled',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send admin email when interview is rescheduled',
            ],
            [
                'key' => 'email_draw_winner_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email to draw winner',
            ],
            [
                'key' => 'email_membership_purchase_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send thank you email after membership purchase',
            ],
            [
                'key' => 'email_membership_expiring_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send reminder email when membership is expiring soon',
            ],
            [
                'key' => 'email_ticket_registration_confirmation_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send confirmation email when draw tickets are registered',
            ],
            [
                'key' => 'email_adoption_application_approved_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when adoption application is approved',
            ],
            [
                'key' => 'email_adoption_application_rejected_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when adoption application is rejected',
            ],
            [
                'key' => 'email_assistance_application_approved_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when assistance application is approved',
            ],
            [
                'key' => 'email_assistance_application_rejected_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when assistance application is rejected',
            ],
            [
                'key' => 'email_fostering_application_approved_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when fostering application is approved',
            ],
            [
                'key' => 'email_fostering_application_rejected_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'communication',
                'description' => 'Send email when fostering application is rejected',
            ],
            // Draw Settings
            [
                'key' => 'draw_payment_info_text',
                'value' => 'Please send your payment via e-transfer to our contact email.',
                'type' => 'string',
                'group' => 'fundraising',
                'description' => 'Payment information message displayed when purchasing draw tickets',
            ],

            // PayPal Settings
            [
                'key' => 'paypal_email',
                'value' => config('services.paypal.email'),
                'type' => 'string',
                'group' => 'payment',
                'description' => 'PayPal account email for receiving payments',
            ],
            [
                'key' => 'paypal_mode',
                'value' => config('services.paypal.mode'),
                'type' => 'string',
                'group' => 'payment',
                'description' => 'PayPal mode (sandbox or live)',
            ],

            // Theme Settings
            [
                'key' => 'theme_preset',
                'value' => 'ocean-blue',
                'type' => 'string',
                'group' => 'theme',
                'description' => 'Color theme preset for the frontend',
            ],

            // Health Settings
            [
                'key' => 'health_check_interval',
                'value' => '30',
                'type' => 'integer',
                'group' => 'health',
                'description' => 'How often (in minutes) the application health checks should run',
            ],
            [
                'key' => 'health_alert_email',
                'value' => config('first.user.email'),
                'type' => 'string',
                'group' => 'health',
                'description' => 'Email address to send health check alert notifications to',
            ],

            // Frontend Settings - Pet Search
            [
                'key' => 'pet_search_name_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable name search on the pets page',
            ],
            [
                'key' => 'pet_search_species_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable species filter on the pets page',
            ],
            [
                'key' => 'pet_search_breed_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable breed filter on the pets page',
            ],
            [
                'key' => 'pet_search_gender_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable gender filter on the pets page',
            ],
            [
                'key' => 'pet_search_size_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable size filter on the pets page',
            ],
            [
                'key' => 'pet_search_age_range_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Enable age range filter on the pets page',
            ],
            [
                'key' => 'show_auth_links',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Show Sign In / Sign Up buttons in the public navigation header',
            ],
            [
                'key' => 'show_print_bio_qr_code',
                'value' => '0',
                'type' => 'boolean',
                'group' => 'frontend',
                'description' => 'Show a QR code linking to the pet\'s public page on the printable bio/PDF document',
            ],
        ];

        Setting::upsert($settings, ['key'], ['value', 'type', 'group', 'description']);
    }
}
