<?php
/**
 * Author Bio Component
 * Include this in blog articles to display author information with E-E-A-T signals
 *
 * Required variables:
 * - $article_author (string): Author name
 *
 * Optional variables:
 * - $author_role (string): Author's job title
 * - $author_bio (string): Short bio description
 * - $author_linkedin (string): LinkedIn URL
 */

// Author database with credentials and bios
$authors = [
    'UK Data Services Editorial Team' => [
        'role' => 'Data Intelligence Experts',
        'bio' => 'Our editorial team comprises data scientists, engineers, and industry analysts with over 50 combined years of experience in web scraping, data analytics, and business intelligence across UK industries.',
        'linkedin' => null,
        'expertise' => ['Web Scraping', 'Data Analytics', 'Business Intelligence', 'GDPR Compliance'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],
    'James Wilson' => [
        'role' => 'Senior Data Architect',
        'bio' => 'James is a Senior Data Architect with 12+ years of experience in enterprise web scraping and business intelligence. He holds a Master\'s degree in Computer Science from Imperial College London and is an AWS Solutions Architect Professional.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Enterprise Architecture', 'Web Scraping', 'Cloud Solutions', 'Data Pipelines'],
        'image' => '/assets/images/authors/james-wilson.svg'
    ],
    'Dr. Rachel Singh' => [
        'role' => 'Lead Data Scientist',
        'bio' => 'Dr. Rachel Singh leads our data science team with expertise in machine learning and AI-powered data extraction. She holds a PhD in Computer Science from University of Cambridge and has published research on NLP and intelligent document processing.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Machine Learning', 'NLP', 'AI', 'Computer Vision'],
        'image' => '/assets/images/authors/rachel-singh.svg'
    ],
    'Michael Thompson' => [
        'role' => 'Technical Lead - Web Scraping',
        'bio' => 'Michael specializes in large-scale web scraping infrastructure and has designed data collection systems for FTSE 100 companies. He has 10+ years of experience in Python, Scrapy, and distributed systems.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Python', 'Scrapy', 'Distributed Systems', 'Web Scraping'],
        'image' => '/assets/images/authors/michael-thompson.svg'
    ],
    'Sarah Chen' => [
        'role' => 'Compliance & Data Protection Officer',
        'bio' => 'Sarah is a certified Data Protection Officer (GDPR-P) with extensive experience in UK and EU data regulations. She ensures all our data collection practices meet the highest compliance standards.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['GDPR', 'Data Protection', 'Compliance', 'Privacy'],
        'image' => '/assets/images/authors/sarah-chen.svg'
    ],
    'David Martinez' => [
        'role' => 'Business Intelligence Consultant',
        'bio' => 'David is a certified Tableau and Power BI consultant with 8+ years of experience helping UK businesses transform raw data into actionable insights. He specializes in dashboard design and data visualization.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Tableau', 'Power BI', 'Data Visualization', 'BI Strategy'],
        'image' => '/assets/images/authors/david-martinez.svg'
    ],
    'Alex Kumar' => [
        'role' => 'Senior Python Engineer',
        'bio' => 'Alex is a Senior Python Engineer specialising in data pipeline architecture and workflow orchestration. He has 9 years of experience building production-grade pipelines with Airflow, Prefect and Dagster for UK data teams.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Python', 'Airflow', 'Prefect', 'Data Pipelines'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],

    'David Thompson' => [
        'role' => 'Data Protection & International Compliance Lead',
        'bio' => 'David Thompson specialises in cross-border data transfer compliance, advising UK businesses on GDPR, UK GDPR, SCCs and adequacy decisions. He has over 10 years of experience in international data law.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['GDPR', 'Data Transfers', 'SCCs', 'UK GDPR'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],

    'Emily Roberts' => [
        'role' => 'Data Subject Rights Specialist',
        'bio' => 'Emily Roberts is a certified data protection practitioner with expertise in operationalising data subject rights under UK GDPR. She has helped over 40 UK organisations build compliant DSR workflows.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['GDPR', 'Data Subject Rights', 'Privacy', 'Compliance'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],

    'Michael Chen' => [
        'role' => 'Data Engineer & Manufacturing Analytics Specialist',
        'bio' => 'Michael Chen is a data engineer with deep expertise in manufacturing analytics and supply chain data transformation. He has designed data systems for UK manufacturers across automotive, FMCG and industrial sectors.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Data Engineering', 'Manufacturing Analytics', 'ETL', 'Supply Chain'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],

    'Sarah Mitchell' => [
        'role' => 'Fintech Data Analyst',
        'bio' => 'Sarah Mitchell is a fintech data analyst with 7 years of experience in UK financial services market intelligence. She specialises in regulatory data analysis, open banking datasets and fintech competitive intelligence.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Fintech', 'Market Analysis', 'Open Banking', 'Financial Data'],
        'image' => '/assets/images/authors/team-avatar.svg'
    ],
    'Emma Richardson' => [
        'role' => 'Industry Analyst',
        'bio' => 'Emma covers UK market trends and industry analysis with a focus on retail, property, and e-commerce sectors. She has over 6 years of experience in competitive intelligence and market research.',
        'linkedin' => 'https://linkedin.com/company/ukdataservices',
        'expertise' => ['Market Research', 'Competitive Intelligence', 'E-commerce', 'Retail Analytics'],
        'image' => '/assets/images/authors/emma-richardson.svg'
    ]
];

// Get author info
$author_name = isset($article_author) ? $article_author : 'UK Data Services Editorial Team';
$author_info = isset($authors[$author_name]) ? $authors[$author_name] : $authors['UK Data Services Editorial Team'];
?>

<div class="author-bio" itemscope itemtype="https://schema.org/Person">
    <div class="bio-avatar">
        <img src="<?php echo htmlspecialchars($author_info['image']); ?>"
             alt="<?php echo htmlspecialchars($author_name); ?>"
             loading="lazy"
             width="80"
             height="80"
             itemprop="image">
    </div>
    <div class="bio-info">
        <h4 class="bio-header">About the Author</h4>
        <p class="bio-name" itemprop="name"><?php echo htmlspecialchars($author_name); ?></p>
        <p class="bio-role" itemprop="jobTitle"><?php echo htmlspecialchars($author_info['role']); ?></p>
        <p class="bio-description" itemprop="description"><?php echo htmlspecialchars($author_info['bio']); ?></p>

        <div class="bio-expertise">
            <span class="expertise-label">Expertise:</span>
            <?php foreach ($author_info['expertise'] as $skill): ?>
                <span class="expertise-tag"><?php echo htmlspecialchars($skill); ?></span>
            <?php endforeach; ?>
        </div>

        <?php if ($author_info['linkedin']): ?>
        <div class="bio-social">
            <a href="<?php echo htmlspecialchars($author_info['linkedin']); ?>"
               target="_blank"
               rel="noopener noreferrer"
               itemprop="sameAs"
               class="linkedin-link">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
                    <path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/>
                </svg>
                Connect on LinkedIn
            </a>
        </div>
        <?php endif; ?>
    </div>
</div>

