#!/usr/bin/env python
# Generates create_stripe_products.ps1 with all actual Stripe IDs

lines = [
    "# TradiesVoice Stripe Products, Prices and Payment Links",
    "# Live Stripe API - AUD Currency",
    "# Created: 2026-02-24 via Genesis System",
    "# All IDs below are LIVE in Stripe.",
    "",
    "param()",
    "",
    "# ========== EXISTING STRIPE IDs (LIVE) ==========",
    "",
    "$STRIPE_KEY = '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'",
    "",
    "# Products",
    "$PRODUCTS = @{",
    "    starter      = 'prod_U2CDhRRuQ3xRRs'",
    "    growth       = 'prod_U2CEMlrSECBuXO'",
    "    suite        = 'prod_U2CEVCsES9OjRN'",
    "    voice_bundle = 'prod_U2CERiXbQwGvsA'",
    "    setup_fee    = 'prod_U2CEZsnr54pjk1'",
    "}",
    "",
    "# Prices",
    "$PRICES = @{",
    "    starter_monthly      = 'price_1T47qPDLQcR6UMj9aykSXZk0'  # AUD 497/mo",
    "    starter_annual       = 'price_1T47qRDLQcR6UMj9e3DaZEN7'  # AUD 3999/yr",
    "    growth_monthly       = 'price_1T47qTDLQcR6UMj9AVtHmU1U'  # AUD 697/mo",
    "    growth_annual        = 'price_1T47qUDLQcR6UMj97faDAP32'  # AUD 5799/yr",
    "    suite_monthly        = 'price_1T47qWDLQcR6UMj9X13ggMI9'  # AUD 997/mo",
    "    suite_annual         = 'price_1T47qYDLQcR6UMj9PT0kULWr'  # AUD 8499/yr",
    "    voice_bundle_monthly = 'price_1T47qaDLQcR6UMj959ud7xPp'  # AUD 897/mo",
    "    voice_bundle_annual  = 'price_1T47qdDLQcR6UMj9aGgJ8lOH'  # AUD 8976/yr",
    "    setup_fee            = 'price_1T47qfDLQcR6UMj9QjT8rGsu'  # AUD 497 one-time",
    "}",
    "",
    "# Payment Links",
    "$PAYMENT_LINKS = @{",
    "    starter_monthly      = 'https://buy.stripe.com/dRm5kDg6Q78B7Tzb5l6AM0i'",
    "    starter_annual       = 'https://buy.stripe.com/00w5kD5sc2Slc9PflB6AM0j'",
    "    growth_monthly       = 'https://buy.stripe.com/bJe9AT07S0Kd8XDgpF6AM0k'",
    "    growth_annual        = 'https://buy.stripe.com/eVq7sL8EofF7a1Hddt6AM0l'",
    "    suite_monthly        = 'https://buy.stripe.com/14A6oH6wg78BddTehx6AM0m'",
    "    suite_annual         = 'https://buy.stripe.com/00w5kD9Is8cF7Tz8Xd6AM0n'",
    "    voice_bundle_monthly = 'https://buy.stripe.com/4gM4gzdYI9gJ3Dj1uL6AM0o'",
    "    voice_bundle_annual  = 'https://buy.stripe.com/00wdR99Is3Wp7Tz5L16AM0p'",
    "}",
    "",
    "# ========== STRIPE API HELPER ==========",
    "",
    "function Invoke-StripePost([string]$Endpoint, [hashtable]$Body) {",
    '    $b64 = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${STRIPE_KEY}:"))',
    "    $headers = @{ Authorization = \"Basic $b64\"; 'Content-Type' = 'application/x-www-form-urlencoded' }",
    "    $parts = $Body.GetEnumerator() | ForEach-Object {",
    '        "$([Uri]::EscapeDataString($_.Key))=$([Uri]::EscapeDataString($_.Value))"',
    "    }",
    "    $bodyStr = $parts -join '&'",
    '    return Invoke-RestMethod -Uri "https://api.stripe.com/v1/$Endpoint" -Method POST -Headers $headers -Body $bodyStr',
    "}",
    "",
    "# ========== DISPLAY REFERENCE ==========",
    "",
    "Write-Host '=== TradiesVoice Stripe Reference ===' -ForegroundColor Cyan",
    "Write-Host 'Products:' -ForegroundColor Yellow",
    '$PRODUCTS.GetEnumerator() | Sort-Object Key | ForEach-Object {',
    '    Write-Host ("  " + $_.Key.PadRight(15) + " $($_.Value)")',
    "}",
    "Write-Host 'Prices:' -ForegroundColor Yellow",
    '$PRICES.GetEnumerator() | Sort-Object Key | ForEach-Object {',
    '    Write-Host ("  " + $_.Key.PadRight(25) + " $($_.Value)")',
    "}",
    "Write-Host 'Payment Links:' -ForegroundColor Yellow",
    '$PAYMENT_LINKS.GetEnumerator() | Sort-Object Key | ForEach-Object {',
    '    Write-Host ("  " + $_.Key.PadRight(25) + " $($_.Value)") -ForegroundColor Green',
    "}",
    "",
    "Write-Host ''",
    "Write-Host 'JavaScript for pricing_page.html:' -ForegroundColor Cyan",
    "Write-Host 'const PAYMENT_LINKS = {'",
    "Write-Host \"  starter:     { monthly: 'https://buy.stripe.com/dRm5kDg6Q78B7Tzb5l6AM0i', annual: 'https://buy.stripe.com/00w5kD5sc2Slc9PflB6AM0j' },\"",
    "Write-Host \"  growth:      { monthly: 'https://buy.stripe.com/bJe9AT07S0Kd8XDgpF6AM0k', annual: 'https://buy.stripe.com/eVq7sL8EofF7a1Hddt6AM0l' },\"",
    "Write-Host \"  suite:       { monthly: 'https://buy.stripe.com/14A6oH6wg78BddTehx6AM0m', annual: 'https://buy.stripe.com/00w5kD9Is8cF7Tz8Xd6AM0n' },\"",
    "Write-Host \"  voiceBundle: { monthly: 'https://buy.stripe.com/4gM4gzdYI9gJ3Dj1uL6AM0o', annual: 'https://buy.stripe.com/00wdR99Is3Wp7Tz5L16AM0p' }\"",
    "Write-Host '};'",
]

out = "\r\n".join(lines)
with open(r'E:\genesis-system\TRADIES\pricing\create_stripe_products.ps1', 'w', encoding='utf-8') as f:
    f.write(out)
print(f"Written {len(lines)} lines")
