<?php
/**
 * Generator for SmartThink Insights articles.
 * Run from project root: php scripts/generate_insight_articles.php
 */

$baseDir = __DIR__ . '/../website';

$articles = [
    ['slug' => 'insights-digital-transformation-failure', 'title' => 'Why 70% of Digital Transformations Fail — and the Four Things That Determine Which 30% Succeed', 'category' => 'Digital Transformation', 'excerpt' => 'The organisations succeeding at digital transformation are not the ones with the largest technology budgets. They are the ones that align leadership, clarity, capability, and governance.'],
    ['slug' => 'insights-ai-readiness', 'title' => 'The AI Readiness Assessment: What Every Organization Needs Before Starting Their AI Journey', 'category' => 'AI & Intelligence', 'excerpt' => 'AI adoption is accelerating, but readiness varies widely. This assessment framework helps organizations understand where they stand and where to begin.'],
    ['slug' => 'insights-ciso-ai-governance', 'title' => 'The CISO Guide to AI Governance: Why Your Security Framework Must Evolve for the AI Era', 'category' => 'Cybersecurity', 'excerpt' => 'AI introduces new attack surfaces, data risks, and governance requirements. Security leaders must adapt their frameworks now.'],
    ['slug' => 'insights-ai-governance-certification', 'title' => 'AI Governance Certification: What It Is and Why Demand Is Accelerating in 2026', 'category' => 'Academy', 'excerpt' => 'As AI regulation expands, organizations are seeking professionals who can govern AI responsibly. Certification demand is surging.'],
    ['slug' => 'insights-digital-maturity', 'title' => 'The Digital Maturity Assessment: A CEO-Level Diagnostic', 'category' => 'Digital Transformation', 'excerpt' => 'Digital maturity is not about technology adoption alone. It is about leadership, culture, data, and the ability to execute.'],
    ['slug' => 'insights-soc2-readiness', 'title' => 'SOC 2 Readiness in 90 Days: A Practical Roadmap', 'category' => 'Cybersecurity', 'excerpt' => 'SOC 2 can seem overwhelming, but a disciplined 90-day roadmap can prepare most organizations for a successful audit.'],
    ['slug' => 'insights-ai-document-processing', 'title' => 'Eliminating Document Bottlenecks with AI: What Compliance Teams Need to Know', 'category' => 'AI & Intelligence', 'excerpt' => 'AI document processing is reducing review time by 70% or more for compliance teams — when implemented with the right governance.'],
    ['slug' => 'insights-cloud-security-2026', 'title' => 'Cloud Security in 2026: The Five Controls Every Organization Must Get Right', 'category' => 'Cybersecurity', 'excerpt' => 'As cloud adoption matures, the basics still matter most. Identity, data protection, logging, architecture, and governance remain the foundations.'],
    ['slug' => 'insights-ai-ethics-framework', 'title' => 'Building an AI Ethics Framework That Actually Works', 'category' => 'AI & Intelligence', 'excerpt' => 'Ethics frameworks fail when they are abstract. The most effective ones embed principles into decision-making, procurement, and deployment processes.'],
    ['slug' => 'insights-e-government-africa', 'title' => 'E-Government in Africa: Lessons from Digital Service Delivery at Scale', 'category' => 'Enterprise Solutions', 'excerpt' => 'Digital government across Africa is moving from pilots to platforms. Success depends on infrastructure, policy, user-centred design, and local capacity.'],
];

$template = <<<'HTML'
<?php
require_once __DIR__ . '/_site_content.php';
$activePage = 'insights';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{TITLE}} — SmartThink Insights</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="../assets/css/smartthink-global.css">
</head>
<body>
<?php include __DIR__ . '/includes/header.php'; ?>

    <section class="st-hero" style="min-height: 45vh; padding: 8rem 0 4rem;">
        <div class="container">
            <nav aria-label="breadcrumb" class="mb-3"><ol class="breadcrumb" style="--bs-breadcrumb-divider: '>';"><li class="breadcrumb-item"><a href="insights.php" style="color: rgba(255,255,255,.7);">Insights</a></li><li class="breadcrumb-item active" aria-current="page" style="color: #fff;">{{CATEGORY}}</li></ol></nav>
            <div class="st-hero-badge" style="background: {{BADGE_COLOR}}; color: var(--navy-primary); padding: .25rem .75rem; border-radius: 4px; display: inline-block;"><span>{{CATEGORY}}</span></div>
            <h1 class="mt-3">{{TITLE}}</h1>
            <p>{{EXCERPT}}</p>
        </div>
    </section>

    <section class="st-section">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-lg-8">
                    <p class="lead">{{EXCERPT}}</p>
                    <p>This article explores the strategic, operational, and technical dimensions that leaders must consider when pursuing AI, digital transformation, and cybersecurity initiatives. It draws on SmartThink Global Technology's experience advising governments, enterprises, and institutions across the United States, United Kingdom, and Africa.</p>
                    <h2>Key Takeaways</h2>
                    <ul>
                        <li>Start with a clear business outcome, not a technology purchase.</li>
                        <li>Build governance and security into the initiative from the beginning.</li>
                        <li>Invest in the people and capabilities needed to sustain the change.</li>
                        <li>Measure progress with meaningful metrics, not activity.</li>
                    </ul>
                    <p>For organizations ready to move from insight to action, SmartThink Global Technology offers assessments, consulting, and implementation support designed to accelerate outcomes and reduce risk.</p>
                </div>
            </div>
        </div>
    </section>

    <section class="st-section-navy final-cta">
        <div class="container">
            <h2>Want to Discuss This Topic?</h2>
            <div class="final-cta-actions">
                <a class="st-btn st-btn-primary" href="contact.php">Schedule a Consultation</a>
                <a class="st-btn st-btn-ghost-white" href="insights.php">View All Insights</a>
            </div>
        </div>
    </section>

<?php include __DIR__ . '/includes/footer.php'; ?>
HTML;

$categoryBadgeColor = [
    'AI & Intelligence' => 'var(--blue-accent)',
    'Digital Transformation' => 'var(--gold-accent)',
    'Cybersecurity' => 'var(--teal-accent)',
    'Academy' => 'var(--teal-accent)',
    'Enterprise Solutions' => 'var(--gold-accent)',
];

foreach ($articles as $article) {
    $badgeColor = $categoryBadgeColor[$article['category']] ?? 'var(--blue-accent)';
    $output = str_replace(
        ['{{TITLE}}', '{{CATEGORY}}', '{{EXCERPT}}', '{{BADGE_COLOR}}'],
        [$article['title'], $article['category'], $article['excerpt'], $badgeColor],
        $template
    );
    $file = $baseDir . '/' . $article['slug'] . '.php';
    file_put_contents($file, $output);
    echo "Generated: {$article['slug']}.php\n";
}

echo "Done. Generated " . count($articles) . " insight articles.\n";
