#!/usr/bin/env python3
"""
Add region-specific money-saving tips to ALL product translation files.
"""

import json

# Regional tips for each product and market
regional_tips = {
    'formula': {
        'US': [
            {"title": "🏪 Generic Formulas Work", "text": "Store brands and generics have the same FDA-regulated nutrients as name brands, at 30-50% less."},
            {"title": "📦 Subscribe & Save", "text": "Amazon Subscribe & Save or warehouse club memberships save 15-20% on formula."},
            {"title": "🎁 Get Free Samples", "text": "Sign up with Enfamil, Similac, and Gerber for free samples and coupons. Pediatrician offices often have samples too."},
            {"title": "💰 Check WIC", "text": "WIC provides free formula for eligible families. Check if you qualify—it can save thousands."}
        ],
        'MX': [
            {"title": "🏪 Marcas Genéricas Funcionan", "text": "Las marcas genéricas tienen los mismos nutrientes regulados que las marcas de nombre, a 30-50% menos."},
            {"title": "📦 Compra al Mayoreo", "text": "Costco y Sam's Club ofrecen descuentos por volumen. Compra packs grandes para ahorrar 15-20%."},
            {"title": "🎁 Muestras Gratis", "text": "Regístrate en sitios de Enfamil, Similac y Gerber para muestras y cupones. Los pediatras también tienen muestras."},
            {"title": "💰 Programas de Apoyo", "text": "Algunos hospitales y programas gubernamentales proporcionan fórmula gratis. Pregunta en tu centro de salud."}
        ],
        'ES': [
            {"title": "🏪 Marcas Blancas Funcionan", "text": "Las marcas de Mercadona y Carrefour tienen los mismos nutrientes que las marcas premium, a 30-50% menos."},
            {"title": "📦 Compra en Packs", "text": "Los packs ahorro en supermercados o Amazon España ofrecen 15-20% de descuento."},
            {"title": "🎁 Aprovecha Promociones", "text": "Farmacias como DOZ y plataformas online tienen ofertas regulares. Usa tarjetas de fidelidad."},
            {"title": "💡 Consulta al Pediatra", "text": "Los pediatras pueden recomendar marcas más económicas que cumplen los estándares europeos."}
        ],
        'CA': [
            {"title": "🏪 Generic Formulas Work", "text": "Store brands meet the same Health Canada standards as premium brands, at 30-50% less."},
            {"title": "📦 Buy in Bulk", "text": "Costco and Amazon Subscribe & Save offer significant savings on formula purchases."},
            {"title": "🎁 Free Samples", "text": "Sign up with formula brands for free samples. Many pediatricians and hospitals provide samples too."},
            {"title": "💰 Provincial Programs", "text": "Some provinces offer formula assistance for low-income families. Check your local health unit."}
        ]
    },
    'wipes': {
        'US': [
            {"title": "🏪 Store Brands Work", "text": "Target, Walmart, and Amazon wipes are 40-60% cheaper and work just as well."},
            {"title": "📦 Buy in Bulk", "text": "Warehouse club packs or Subscribe & Save can save 20-30% vs. single packs."},
            {"title": "💧 Water Wipes for Newborns Only", "text": "Water wipes are great for newborns but expensive. Switch to regular after a few weeks."},
            {"title": "🧻 DIY Wipes", "text": "Make your own with paper towels, water, and baby oil. Costs pennies per wipe."}
        ],
        'MX': [
            {"title": "🏪 Marcas Propias Funcionan", "text": "Las toallitas de Walmart y Soriana son 40-60% más baratas y funcionan igual."},
            {"title": "📦 Compra al Mayoreo", "text": "Los packs grandes en Costco o Sam's ahorran 20-30% comparado con packs individuales."},
            {"title": "💧 Toallitas de Agua Solo al Inicio", "text": "Las toallitas de agua son buenas para recién nacidos pero caras. Cambia a regulares después de unas semanas."},
            {"title": "🧻 Toallitas Caseras", "text": "Haz tus propias toallitas con toallas de papel, agua y aceite de bebé. Cuestan centavos."}
        ],
        'ES': [
            {"title": "🏪 Marcas Blancas Funcionan", "text": "Las toallitas de Mercadona y Lidl son 40-60% más baratas y funcionan igual."},
            {"title": "📦 Compra en Packs Grandes", "text": "Los packs ahorro ahorran 20-30% comparado con packs pequeños."},
            {"title": "💧 Toallitas de Agua al Principio", "text": "Las toallitas de agua son ideales para recién nacidos pero caras. Cambia a normales después."},
            {"title": "🧻 Toallitas Caseras", "text": "Puedes hacer tus propias toallitas con papel, agua y aceite de bebé. Muy económicas."}
        ],
        'CA': [
            {"title": "🏪 Store Brands Work", "text": "Walmart, Costco Kirkland, and Amazon brands are 40-60% cheaper and just as effective."},
            {"title": "📦 Buy in Bulk", "text": "Warehouse clubs and Subscribe & Save offer 20-30% savings on wipes."},
            {"title": "💧 Water Wipes for Newborns", "text": "Water wipes are gentle for newborns but expensive. Switch to regular after initial weeks."},
            {"title": "♻️ Reusable Cloth Wipes", "text": "Some families use cloth wipes (like washcloths). Wash with diapers and save hundreds."}
        ]
    },
    'bottles': {
        'US': [
            {"title": "🏪 Start Simple", "text": "You don't need expensive bottles. Many babies do fine with basic store-brand bottles ($3-5 each)."},
            {"title": "🍼 Buy a Variety Pack First", "text": "Babies can be picky. Buy a small variety pack to test before committing to a full set."},
            {"title": "♻️ Skip the Sterilizer", "text": "Dishwasher or boiling water works fine. Save $50-100 by skipping the dedicated sterilizer."},
            {"title": "🎁 Registry Freebies", "text": "Amazon, Target, and Babylist give welcome boxes with free bottle samples. Test before buying."}
        ],
        'MX': [
            {"title": "🏪 Empieza Simple", "text": "No necesitas biberones caros. Muchos bebés están bien con biberones básicos de tienda ($60-100 cada uno)."},
            {"title": "🍼 Compra un Pack Variado", "text": "Los bebés pueden ser exigentes. Compra un pack pequeño para probar antes de comprar todo."},
            {"title": "♻️ Evita el Esterilizador", "text": "El lavavajillas o agua hirviendo funcionan bien. Ahorra $1,000-2,000 sin esterilizador dedicado."},
            {"title": "🎁 Muestras Gratis", "text": "Liverpool y Baby'O tienen programas de registro con muestras gratis de biberones."}
        ],
        'ES': [
            {"title": "🏪 Empieza Simple", "text": "No necesitas biberones caros. Muchos bebés funcionan bien con biberones básicos (3-5€ cada uno)."},
            {"title": "🍼 Compra un Pack Variado", "text": "Los bebés pueden ser selectivos. Compra un pack pequeño para probar antes de comprar un juego completo."},
            {"title": "♻️ Evita el Esterilizador", "text": "El lavavajillas o agua hirviendo es suficiente. Ahorra 50-100€ sin esterilizador dedicado."},
            {"title": "🎁 Aprovecha Ofertas", "text": "Farmacias y El Corte Inglés tienen packs de bienvenida con muestras de biberones."}
        ],
        'CA': [
            {"title": "🏪 Start Simple", "text": "Basic bottles work great. Many babies do fine with affordable store brands ($4-6 each)."},
            {"title": "🍼 Buy a Variety First", "text": "Babies can be particular. Try a mixed pack before investing in a full set."},
            {"title": "♻️ Skip the Sterilizer", "text": "Dishwasher or boiling water works perfectly. Save $60-120 by not buying a sterilizer."},
            {"title": "🎁 Welcome Boxes", "text": "Register at Buy Buy Baby or Amazon for free sample bottles and feeding supplies."}
        ]
    },
    'breast-pumps': {
        'US': [
            {"title": "💰 Insurance Covers It", "text": "ACA requires most insurance to cover breast pumps at no cost. Check your plan—you might get a free $300+ pump."},
            {"title": "🏥 Hospital-Grade Rentals", "text": "Rent hospital-grade pumps for $50-80/month instead of buying. Great for short-term or occasional use."},
            {"title": "🛒 Buy Used (Closed System)", "text": "Closed-system pumps (Spectra, Medela Symphony) can be safely bought used. Save $100-200."},
            {"title": "💡 Manual for Backup", "text": "A $30 manual pump is great for travel or occasional use. Don't overbuy electric if you don't need it."}
        ],
        'MX': [
            {"title": "🏥 Consulta tu Seguro", "text": "Algunos seguros cubren extractores. Verifica con tu plan—podrías obtener uno gratis."},
            {"title": "🛒 Compra de Segunda Mano", "text": "Los extractores de sistema cerrado (Spectra, Medela) se pueden comprar usados de forma segura. Ahorra $2,000-4,000."},
            {"title": "💡 Manual como Respaldo", "text": "Un extractor manual de $600 es excelente para viajes o uso ocasional. No gastes de más en eléctrico."},
            {"title": "🏪 Compara Precios", "text": "Liverpool, Amazon México y farmacias tienen diferentes precios. Compara antes de comprar."}
        ],
        'ES': [
            {"title": "🏥 Sanidad Pública", "text": "La Seguridad Social proporciona extractores en algunos casos. Consulta con tu matrona."},
            {"title": "🛒 Compra de Segunda Mano", "text": "Los extractores de sistema cerrado se pueden comprar usados de forma segura. Ahorra 100-200€."},
            {"title": "💡 Manual como Respaldo", "text": "Un extractor manual de 30€ es perfecto para viajes o uso ocasional."},
            {"title": "♻️ Alquiler", "text": "Farmacias alquilan extractores de grado hospitalario por 40-60€/mes. Ideal para uso corto."}
        ],
        'CA': [
            {"title": "💰 Check Your Benefits", "text": "Some provincial health plans and private insurance cover breast pumps. Verify your coverage."},
            {"title": "🏥 Hospital Rentals", "text": "Rent hospital-grade pumps for $60-100/month. Many hospitals and pharmacies offer this service."},
            {"title": "🛒 Buy Used (Closed System)", "text": "Closed-system pumps are safe to buy used. Save $150-250 on gently used models."},
            {"title": "💡 Manual for Backup", "text": "A $40 manual pump works great for occasional use or travel. Don't overbuy."}
        ]
    }
}

# Map products to translation files
products = ['formula', 'wipes', 'bottles', 'breast-pumps']
markets = {
    'US': 'en',
    'MX': 'es-MX', 
    'ES': 'es-ES',
    'CA': 'fr-CA'
}

base_path = '/root/clawd/stroller-app/data/i18n/'

for product in products:
    for market, lang_code in markets.items():
        filename = f'{product}-{lang_code}.json'
        filepath = base_path + filename
        
        # Read existing translation file
        try:
            with open(filepath, 'r') as f:
                data = json.load(f)
        except FileNotFoundError:
            print(f'⚠️  {filename} not found, skipping')
            continue
        
        # Add regional tips
        if 'tips' not in data:
            data['tips'] = {}
        
        data['tips']['items'] = regional_tips[product][market]
        
        # Write updated file
        with open(filepath, 'w') as f:
            json.dump(data, f, indent=2, ensure_ascii=False)
        
        print(f'✓ Added {market} tips to {filename}')

print('\n✅ All regional tips added to all products!')
print(f'   Updated {len(products)} products × {len(markets)} markets = {len(products) * len(markets)} files')
