<?php

namespace Database\Seeders;

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

class PageContentSeeder extends Seeder
{
    public function run(): void
    {
        $pages = [
            'homepage' => [
                ['key' => 'hero_title',    'value' => 'Premium Research Peptides', 'type' => 'text'],
                ['key' => 'hero_subtitle', 'value' => 'Pharmaceutical-grade peptides for serious researchers. Third-party tested, UK-dispatched, fully documented.', 'type' => 'text'],
                ['key' => 'hero_cta',      'value' => 'Shop All Peptides', 'type' => 'text'],
                ['key' => 'stat_1_number', 'value' => '500+', 'type' => 'text'],
                ['key' => 'stat_1_label',  'value' => 'Research Compounds', 'type' => 'text'],
                ['key' => 'stat_2_number', 'value' => '99.9%', 'type' => 'text'],
                ['key' => 'stat_2_label',  'value' => 'Purity Guaranteed', 'type' => 'text'],
                ['key' => 'stat_3_number', 'value' => '48hr', 'type' => 'text'],
                ['key' => 'stat_3_label',  'value' => 'UK Dispatch', 'type' => 'text'],
                ['key' => 'stat_4_number', 'value' => '10k+', 'type' => 'text'],
                ['key' => 'stat_4_label',  'value' => 'Researchers Served', 'type' => 'text'],
            ],
            'about' => [
                ['key' => 'title',       'value' => 'About BioSupply UK', 'type' => 'text'],
                ['key' => 'subtitle',    'value' => 'Our Story', 'type' => 'text'],
                ['key' => 'body',        'value' => "BioSupply UK was founded by a team of research scientists and peptide enthusiasts committed to advancing the quality and accessibility of research compounds in the United Kingdom.\n\nWe source only from GMP-certified manufacturers and subject every batch to rigorous independent third-party testing. Our certificates of analysis are published openly so researchers can verify purity before purchase.\n\nBased in the UK, we dispatch within 48 hours and offer free tracked shipping on orders over £75.", 'type' => 'text'],
                ['key' => 'mission',     'value' => 'To provide the highest quality research compounds to the scientific community with full transparency, traceability, and trust.', 'type' => 'text'],
            ],
            'faq' => [
                ['key' => 'items', 'value' => json_encode([
                    ['q' => 'What are research peptides?', 'a' => 'Research peptides are short chains of amino acids used exclusively for in vitro scientific research. They are not approved for human or veterinary use.'],
                    ['q' => 'Who can purchase from BioSupply UK?', 'a' => 'Our products are intended for qualified researchers, scientists, and licensed professionals aged 18 and over.'],
                    ['q' => 'How are products tested?', 'a' => 'Every batch is independently tested by accredited third-party laboratories. Certificates of Analysis (CoA) are available on each product page.'],
                    ['q' => 'How long does delivery take?', 'a' => 'We dispatch within 48 hours Monday–Friday. Standard UK delivery is 2–3 working days. Express next-day options are available at checkout.'],
                    ['q' => 'Do you ship internationally?', 'a' => 'Currently we only ship within the United Kingdom. International shipping is on our roadmap for 2025.'],
                    ['q' => 'What is your returns policy?', 'a' => 'Unopened products may be returned within 14 days. Please contact us at info@biosupplyuk.com with your order number.'],
                    ['q' => 'How should peptides be stored?', 'a' => 'Lyophilised peptides should be stored at -20°C away from light and moisture. Once reconstituted, store at 4°C and use within 30 days.'],
                    ['q' => 'Are your products legal in the UK?', 'a' => 'Yes. Research peptides are legal to purchase in the UK for scientific research purposes. They are not controlled substances.'],
                ]), 'type' => 'json'],
            ],
            'shipping' => [
                ['key' => 'title',            'value' => 'Shipping Information', 'type' => 'text'],
                ['key' => 'dispatch_time',    'value' => 'Orders placed before 2pm Monday–Friday are dispatched the same day.', 'type' => 'text'],
                ['key' => 'standard_service', 'value' => 'Royal Mail Tracked 48 — 2–3 working days — FREE on orders over £75, otherwise £3.99', 'type' => 'text'],
                ['key' => 'express_service',  'value' => 'Royal Mail Tracked 24 — Next working day — £5.99', 'type' => 'text'],
                ['key' => 'packaging',        'value' => 'All orders are shipped in plain, discreet packaging with no external branding.', 'type' => 'text'],
                ['key' => 'cold_chain',       'value' => 'Lyophilised peptides are stable at room temperature for transit periods up to 2 weeks. Ice packs are available on request for sensitive shipments.', 'type' => 'text'],
            ],
            'returns' => [
                ['key' => 'title',          'value' => 'Returns & Refunds', 'type' => 'text'],
                ['key' => 'policy',         'value' => 'Due to the nature of research compounds, we are unable to accept returns of opened or used products. Returns of unopened, undamaged products may be accepted within 14 days of receipt.', 'type' => 'text'],
                ['key' => 'damaged',        'value' => 'If your order arrives damaged or you receive an incorrect product, please contact us within 48 hours of receipt at info@biosupplyuk.com with your order number and a photo of the issue.', 'type' => 'text'],
                ['key' => 'refund_time',    'value' => 'Approved refunds are processed within 5–10 working days to your original payment method.', 'type' => 'text'],
                ['key' => 'contact_email',  'value' => 'info@biosupplyuk.com', 'type' => 'text'],
            ],
            'terms' => [
                ['key' => 'title',   'value' => 'Terms & Conditions', 'type' => 'text'],
                ['key' => 'content', 'value' => "**Research Use Only**\nAll products sold by BioSupply UK are intended solely for in vitro laboratory research purposes by qualified researchers. They are not medicines, are not approved for human or veterinary use, and are not intended for diagnosis, treatment, cure, or prevention of any disease.\n\n**Age Requirement**\nYou must be 18 years of age or older to purchase from BioSupply UK. By placing an order you confirm that you meet this requirement.\n\n**Ordering**\nAll prices are in GBP and include VAT where applicable. We reserve the right to refuse or cancel any order at our discretion. Payment is required in full before dispatch.\n\n**Liability**\nBioSupply UK accepts no liability for any misuse of products outside of legitimate laboratory research. The purchaser assumes full responsibility for compliance with all applicable laws and regulations.\n\n**Governing Law**\nThese terms are governed by the laws of England and Wales.", 'type' => 'text'],
                ['key' => 'updated', 'value' => 'January 2025', 'type' => 'text'],
            ],
            'privacy' => [
                ['key' => 'title',   'value' => 'Privacy Policy', 'type' => 'text'],
                ['key' => 'content', 'value' => "**Data We Collect**\nWe collect your name, email address, and delivery address when you place an order. We also collect browsing data to improve site performance.\n\n**How We Use Your Data**\nYour data is used solely to fulfil your orders, communicate with you about your purchases, and improve our services. We do not sell your data to third parties.\n\n**Your Rights (UK GDPR)**\nYou have the right to access, correct, or delete your personal data at any time. Contact us at info@biosupplyuk.com.\n\n**Cookies**\nWe use essential cookies for session management and analytics cookies (anonymised) to understand how visitors use our site. No marketing cookies are used without consent.", 'type' => 'text'],
                ['key' => 'updated', 'value' => 'January 2025', 'type' => 'text'],
            ],
        ];

        foreach ($pages as $page => $fields) {
            foreach ($fields as $field) {
                PageContent::updateOrCreate(
                    ['page' => $page, 'key' => $field['key']],
                    ['value' => $field['value'], 'type' => $field['type']]
                );
            }
        }

        $this->command->info('Page contents seeded.');
    }
}
