import re

filepath = "/root/efesto-qa/source/frontend/src/pages/Subscription.jsx"

with open(filepath, "r") as f:
    content = f.read()

# 1. Add Send, Phone, User icons to imports
content = content.replace(
    "  Sparkles\n} from 'lucide-react'",
    "  Sparkles,\n  Send,\n  Phone,\n  User\n} from 'lucide-react'"
)

# 2. Add contact form state
content = content.replace(
    "const [cancelMessage, setCancelMessage] = useState('')",
    "const [cancelMessage, setCancelMessage] = useState('')\n  const [contactForm, setContactForm] = useState({ name: '', phone: '', message: '' })\n  const [contactSent, setContactSent] = useState(false)"
)

# 3. Replace subscribe button
content = content.replace(
    "{checkoutLoading ? 'Redirigiendo a Stripe...' : 'Suscribirme - $4,500 MXN/mes'}",
    "{checkoutLoading ? 'Redirigiendo a Stripe...' : 'Suscribirme'}"
)

# 4. Replace price in Plan Info
content = content.replace(
    '<span className="text-3xl font-bold text-quantum-600">$4,500</span>\n            <span className="text-gray-500"> MXN/mes</span>',
    '<span className="text-lg font-medium text-quantum-600">Contactanos para conocer precios</span>'
)

# 5. Remove price from active subscription
content = content.replace(
    '                  <p className="text-xl font-bold text-green-800 mt-2">\n                    {formatCurrency(subscription.planPrice)} MXN/mes\n                  </p>',
    ''
)

with open(filepath, "w") as f:
    f.write(content)

print("OK - partial changes applied")
