
import React from 'react';
import { BarclaysLogo } from './icons/BarclaysLogo';
import { DashboardIcon } from './icons/DashboardIcon';
import { AnalyticsIcon } from './icons/AnalyticsIcon';
import { SettingsIcon } from './icons/SettingsIcon';
import { UserIcon } from './icons/UserIcon';
import { CampaignsIcon } from './icons/CampaignsIcon';
import { AuditIcon } from './icons/AuditIcon';

const navigation = [
    { name: 'Home', icon: DashboardIcon },
    { name: 'Campaigns', icon: CampaignsIcon },
    // { name: 'WIP Reviewer', icon: ClipboardIcon }, // Hidden: Moved to Settings > Beta
    // { name: 'CopyGenAI', icon: CopyGenAIIcon },   // Hidden: Moved to Settings > Beta
    { name: 'Analytics', icon: AnalyticsIcon },
    { name: 'Auditing', icon: AuditIcon },
    { name: 'Settings', icon: SettingsIcon },
];

interface SidebarProps {
    activeItem: string;
    onNavigate: (viewName: string) => void;
    userName?: string;
    userEmail?: string;
}

export const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, userName, userEmail }) => {
    return (
        <aside className="w-72 flex-shrink-0 bg-[#0f172a] text-slate-200 flex flex-col border-r border-slate-800 font-sans">
            {/* Brand Header */}
            <div className="h-24 flex items-center px-8 border-b border-slate-800/60">
                <BarclaysLogo className="h-8 w-auto text-white" />
                <div className="ml-3 flex flex-col">
                     <span className="text-lg font-bold tracking-tight text-white leading-tight">
                        Mod Comms
                    </span>
                    <span className="text-xs text-slate-400 uppercase tracking-widest font-semibold">
                        Compliance AI
                    </span>
                </div>
            </div>

            {/* Navigation */}
            <nav className="flex-1 px-4 py-8 space-y-2 overflow-y-auto">
                {navigation.map((item) => {
                    const Icon = item.icon;
                    const isActive = item.name === activeItem;
                    const isComingSoon = (item as any).isComingSoon;

                    return (
                        <button
                            key={item.name}
                            onClick={() => !isComingSoon && onNavigate(item.name)}
                            className={`group w-full flex items-center px-4 py-3.5 text-left text-sm font-medium rounded-xl transition-all duration-300 ease-in-out ${
                                isActive 
                                ? 'bg-gradient-to-r from-brand-accent to-brand-light-blue text-white shadow-lg shadow-brand-accent/20' 
                                : isComingSoon
                                ? 'text-slate-600 cursor-not-allowed'
                                : 'text-slate-400 hover:bg-white/5 hover:text-white'
                            }`}
                            aria-current={isActive ? 'page' : undefined}
                            disabled={isComingSoon}
                        >
                            <Icon className={`h-5 w-5 mr-4 transition-transform duration-300 ${isActive ? 'scale-110' : 'group-hover:scale-110'}`} />
                            <span className="flex-1 tracking-wide">{item.name}</span>
                            {isActive && (
                                <div className="w-1.5 h-1.5 rounded-full bg-white/80 shadow-glow"></div>
                            )}
                        </button>
                    );
                })}
            </nav>

            {/* User Profile Snippet */}
            <div className="p-4 border-t border-slate-800/60 bg-[#0b1120]">
                 <button
                    onClick={() => onNavigate('Profile')}
                    className={`group w-full flex items-center gap-3 p-3 rounded-xl text-left transition-all duration-200 ${
                        activeItem === 'Profile'
                        ? 'bg-slate-800'
                        : 'hover:bg-slate-800'
                    }`}
                >
                    <div className="w-10 h-10 rounded-full bg-gradient-to-br from-brand-dark-blue to-brand-accent flex items-center justify-center ring-2 ring-white/10 group-hover:ring-brand-light-blue/50 transition-all">
                        <UserIcon className="h-5 w-5 text-white" />
                    </div>
                    <div className="overflow-hidden">
                        <p className="font-semibold text-sm text-white truncate">{userName || 'Unknown User'}</p>
                        <p className="text-xs text-slate-400 truncate">{userEmail || ''}</p>
                    </div>
                </button>
            </div>
        </aside>
    );
};
