
import type { TerminalLine } from '$lib/components/tui/types';
import { user, skills, projects } from '$lib/config';

export const lines: TerminalLine[] = [
    // Header command
    { type: 'command', content: 'cat ~/about.md' },
    { type: 'blank', content: '' },

    // Avatar image
    { type: 'image', content: '', image: user.avatar, imageAlt: user.name, imageWidth: 180, inline: true },

    {
        type: 'group',
        content: '',
        groupDirection: 'column',
        groupAlign: 'start',
        inline: true,
        children: [
            // User info
            { type: 'header', content: `(&bold)${user.name}(&)` },
            { type: 'info', content: `(&accent)${user.title}(&)` },
            { type: 'output', content: `(&white)Location:(&) (&primary)${user.location}(&)` },
            { type: 'output', content: `(&muted)${user.bio}(&)` },
        ]
    },

    { type: 'blank', content: '' },
    {
        type: 'group', content: '', groupAlign: 'start', groupGap: '1rem',
        children: [
            { type: 'output', content: `(&primary, bold)Links >(&)`, inline: true },
            { type: 'link', href: "/portfolio#contact", content: `(&bg-blue,black)Contact(&)`, inline: true },
            { type: 'link', href: "/portfolio#skills", content: `(&bg-orange,black)Skills(&)`, inline: true },
            { type: 'link', href: "/portfolio#projects", content: `(&bg-green,black)Projects(&)`, inline: true },
        ]
    },
    { type: 'divider', content: 'CONTACT', id: 'contact' },
    // Contact buttons - dynamically generated from socials array
    ...user.socials.map(social => ({
        type: 'button' as const,
        content: `${social.name}`,
        icon: social.icon,
        style: 'primary' as const,
        href: social.link,
        inline: true
    })),

    { type: 'divider', content: 'SKILLS', id: 'skills' },

    // Skills as TUI sections

    // Languages
    { type: 'info', content: '(&blue,bold)▸ Languages(&)' },
    { type: 'output', content: '  ' + skills.languages.map(s => `(&cyan)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Frameworks
    { type: 'info', content: '(&magenta,bold)▸ Frameworks(&)' },
    { type: 'output', content: '  ' + skills.frameworks.map(s => `(&pink)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Applications
    { type: 'info', content: '(&green,bold)▸ Tools(&)' },
    { type: 'output', content: '  ' + skills.tools.map(s => `(&green)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Platforms
    { type: 'info', content: '(&yellow,bold)▸ Platforms(&)' },
    { type: 'output', content: '  ' + skills.platforms.map(s => `(&yellow)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Applications
    { type: 'info', content: '(&purple,bold)▸ Applications(&)' },
    { type: 'output', content: '  ' + skills.applications.map(s => `(&purple)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Databases
    { type: 'info', content: '(&cyan,bold)▸ Databases(&)' },
    { type: 'output', content: '  ' + skills.databases.map(s => `(&cyan)${s}(&)`).join(' (&muted)•(&) ') },
    { type: 'blank', content: '' },

    // Interests
    { type: 'info', content: '(&accent,bold)▸ Interests(&)' },
    { type: 'output', content: '  ' + skills.interests.map(s => `(&muted)${s}(&)`).join(' (&muted)•(&) ') },

    { type: 'divider', content: 'PROJECTS', id: 'projects' },

    // Featured projects with buttons
    ...projects.filter(p => p.featured).flatMap(project => [
        { type: 'header' as const, content: `(&bold)${project.name}(&)` },
        { type: 'output' as const, content: `(&muted)${project.description}(&)` },
        { type: 'info' as const, content: `(&info)TechStack:(&) (&magenta)${project.tech.join(', ')}(&)` },
        ...(project.github ? [{
            type: 'button' as const,
            content: 'View on GitHub',
            icon: 'mdi:github',
            style: 'accent' as const,
            href: project.github
        }] : []),
        ...(project.live ? [{
            type: 'button' as const,
            content: 'View Live Demo',
            icon: 'mdi:open-in-new',
            style: 'accent' as const,
            href: project.live
        }] : []),
        { type: 'blank' as const, content: '' }
    ]),

    // Other projects
    ...projects.filter(p => !p.featured).flatMap(project => [
        { type: 'success' as const, content: `(&success)${project.name}(&)` },
        { type: 'output' as const, content: `(&muted)${project.description}(&)` },
        { type: 'info' as const, content: `(&info)TechStack:(&) (&magenta)${project.tech.join(', ')}(&)` },
        ...(project.github ? [{
            type: 'button' as const,
            content: 'View on GitHub',
            icon: 'mdi:github',
            style: 'accent' as const,
            href: project.github
        }] : []),
        ...(project.live ? [{
            type: 'button' as const,
            content: 'View Live',
            icon: 'mdi:open-in-new',
            style: 'accent' as const,
            href: project.live
        }] : []),
        { type: 'blank' as const, content: '' }
    ]),

    // End
    { type: 'success', content: `(&success)Portfolio loaded successfully!(&)` }
];