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

import json

# Regional tips for each market
regional_tips = {
    'US': {
        'diapers': [
            {
                "title": "🏪 Store Brands Work",
                "text": "Target, Walmart, and Amazon store brands are 30-50% cheaper and meet the same safety standards."
            },
            {
                "title": "📦 Buy in Bulk",
                "text": "Subscribe & Save on Amazon or buy warehouse sizes at Costco/Sam's Club for 15-20% savings."
            },
            {
                "title": "💰 Stack Coupons",
                "text": "Combine manufacturer coupons with store sales. Apps like Ibotta and Fetch offer cash back."
            },
            {
                "title": "🎯 Check WIC",
                "text": "WIC provides free diapers for eligible families in some states. Check if you qualify—it can save thousands."
            }
        ]
    },
    'MX': {
        'diapers': [
            {
                "title": "🏪 Marcas Propias Funcionan",
                "text": "Las marcas de Walmart, Coppel y Soriana son 30-50% más baratas y cumplen los mismos estándares de seguridad."
            },
            {
                "title": "📦 Compra al Mayoreo",
                "text": "Compra tamaños grandes en Costco o Sam's Club para ahorrar 15-20%."
            },
            {
                "title": "💰 Usa Cupones",
                "text": "Busca promociones en Liverpool, Palacio de Hierro y Bebemundo. Combina cupones con ventas especiales."
            },
            {
                "title": "👶 Programas de Apoyo",
                "text": "Algunos programas gubernamentales y hospitales proporcionan pañales gratis. Pregunta en tu centro de salud."
            }
        ]
    },
    'ES': {
        'diapers': [
            {
                "title": "🏪 Marcas Blancas Funcionan",
                "text": "Las marcas de Mercadona, Carrefour y Lidl son 30-50% más baratas y cumplen los mismos estándares europeos."
            },
            {
                "title": "📦 Compra en Packs Grandes",
                "text": "Los packs ahorro en supermercados o Amazon Prime ofrecen 15-20% de descuento."
            },
            {
                "title": "💰 Aprovecha las Ofertas",
                "text": "El Corte Inglés, Carrefour y Amazon España tienen promociones regulares. Usa tarjetas de fidelidad."
            },
            {
                "title": "♻️ Considera Pañales de Tela",
                "text": "Los pañales de tela cuestan 450-700€ inicialmente pero ahorran más de 1.300€ en 2,5 años."
            }
        ]
    },
    'CA': {
        'diapers': [
            {
                "title": "🏪 Store Brands Work",
                "text": "Walmart, Costco, and Amazon store brands are 30-50% cheaper and meet the same Health Canada standards."
            },
            {
                "title": "📦 Buy in Bulk",
                "text": "Costco and Sam's Club offer bulk savings. Amazon Subscribe & Save provides 15-20% off."
            },
            {
                "title": "💰 Provincial Programs",
                "text": "Some provinces offer diaper assistance programs for low-income families. Check your local health unit."
            },
            {
                "title": "♻️ Cloth Diaper Rebates",
                "text": "Some municipalities offer rebates for cloth diapers. Check if your city has an incentive program."
            }
        ]
    }
}

# Map market codes to regional tip keys
market_map = {
    'US': 'US',
    'MX': 'MX',
    'ES': 'ES',
    'CA': 'CA'
}

# Update translation files
files = {
    'diapers-en.json': ('US', 'en'),
    'diapers-es-MX.json': ('MX', 'es'),
    'diapers-es-ES.json': ('ES', 'es'),
    'diapers-fr-CA.json': ('CA', 'fr')
}

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

for filename, (market, lang) in files.items():
    filepath = base_path + filename
    
    with open(filepath, 'r') as f:
        data = json.load(f)
    
    # Add regional tips
    if 'tips' not in data:
        data['tips'] = {}
    
    data['tips']['items'] = regional_tips[market]['diapers']
    
    with open(filepath, 'w') as f:
        json.dump(data, f, indent=2, ensure_ascii=False)
    
    print(f'✓ Added {market} regional tips to {filename}')

print('\n✅ All regional tips added to translation files!')
