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

// const artist = [
//     {
//         name: 'Noah Floersch',
//         url: 'https://music.youtube.com/channel/UCgPjhKqPg5cPxErhqnoPlWg?si=B7GEz2QMNtrgnAbz'
//     },
//     {
//         name: 'Laufey',
//         url: 'https://music.youtube.com/channel/UCJtROTPxo3qnEzww8JyDxuA?si=WwgYFkoccnXtJ6Im'
//     },
//     {
//         name: 'Tate McRae',
//         url: 'https://music.youtube.com/channel/UCz86IA7ooUetFnUGa_YlsVw?si=A1t0-hLHswhbEG0U'
//     }
// ]

const hobbies = [
    {
        name: 'Swimming',
        description: 'I enjoy swimming as a way to relax and stay active. It is my favorite sport.',
        icon: 'proicons:person-swim'
    },
    {
        name: 'Baking',
        description: 'I love baking pastries and experimenting with new dessert recipes.',
        icon: 'proicons:cake'
    },
    {
        name: 'Robotics',
        description: 'Building and programming robots to solve problems is fun.',
        icon: 'proicons:robot'
    }
]

const games = [
    {
        name: 'Minecraft',
        image: '/img/minecraft.png',
        url: 'https://minecraft.net',
        link: 'https://minecraft.net'
    },
    {
        name: 'Pokemon TCG Online',
        image: '/img/pokemontcg.png',
        url: 'https://www.pokemon.com/us/pokemon-tcg'
    },
    {
        name: "Fire Watch",
        image: '/img/firewatch.png',
        url: 'https://firewatchgame.com'
    },
    {
        name: "Expediton 33",
        image: '/img/e33.png',
        url: 'https://expedition33.com'
    },
    {
        name: "Mini Motorways",
        image: '/img/mini.png',
        url: 'https://store.steampowered.com/app/1127500/Mini_Motorways/'
    },
    {
        name: "Risk",
        image: '/img/risk.png',
        url: 'https://store.steampowered.com/app/1128810/RISK_Global_Domination/'
    },
    {
        name: "Slay the Spire",
        image: '/img/slay_the_spire.png',
        url: 'https://store.steampowered.com/app/646570/Slay_the_Spire/'
    },
    {
        name: "Slay the Spire 2",
        image: '/img/slay_the_spire_2.png',
        url: 'https://store.steampowered.com/app/2868840/Slay_the_Spire_2/'
    }
]

let shows = [
    {
        name: 'Silo',
        rating: '10/10',
        imdburl: 'https://www.imdb.com/title/tt14688458/'
    },
    {
        name: 'The Mandalorian',
        rating: '7/10',
        imdburl: 'https://www.imdb.com/title/tt8111088/'
    },
    {
        name: "Andor",
        rating: '9/10',
        imdburl: 'https://www.imdb.com/title/tt9253284/'
    },
    {
        name: 'Severance',
        rating: '9/10',
        imdburl: 'https://www.imdb.com/title/tt11280740/'
    },
    {
        name: "D.P. (KDrama)",
        rating: '10/10',
        imdburl: 'https://www.imdb.com/title/tt13024974/'
    }
];

shows = shows.sort((a, b) => {
    const ratingA = parseFloat(a.rating.split('/')[0]);
    const ratingB = parseFloat(b.rating.split('/')[0]);
    return ratingB - ratingA;
});


let movies = [
    {
        name: 'Interstellar',
        rating: '10/10',
        imdburl: 'https://www.imdb.com/title/tt0816692/'
    },
    {
        name: "How to Train Your Dragon",
        rating: '10/10',
        imdburl: 'https://www.imdb.com/title/tt1621800/'
    }
];

movies = movies.sort((a, b) => {
    const ratingA = parseFloat(a.rating.split('/')[0]);
    const ratingB = parseFloat(b.rating.split('/')[0]);
    return ratingB - ratingA;
});


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

    { type: 'image', content: '', image: user.avatar, imageAlt: user.name, imageWidth: 200, inline: true },
    {
        type: 'group',
        content: '',
        groupDirection: 'column',
        groupAlign: 'start',
        inline: true,
        children: [
            { type: 'blank', content: '' },
            { type: 'header', content: `(&bold)${user.displayname}(&)` },
            { 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: "/about#hobbies", content: `(&bg-blue, black, bold)Hobbies(&)`, inline: true },
            { type: 'link', href: "/about#games", content: `(&bg-orange, black, bold)Games(&)`, inline: true },
            { type: 'link', href: "/about#shows", content: `(&bg-yellow, black, bold)Shows(&)`, inline: true },
            { type: 'link', href: "/about#movies", content: `(&bg-green, black, bold)Movies(&)`, inline: true },
            // { type: 'link', href: "/about#music", content: `(&bg-accent, black, bold)Music(&)`, inline: true },
        ]
    },


    { type: 'divider', content: 'Hobbies', id: 'hobbies' },
    {
        type: 'group',
        content: '',
        display: 'grid',
        children: hobbies.map((h): TerminalLine => ({
            type: 'card',
            cardTitle: h.name,
            icon: h.icon,
            content: h.description,
            cardWidth: 1,
            cardFloat: 'center',
        }))
    },
    { type: 'blank', content: '' },

    { type: 'divider', content: 'Games', id: 'games' },
    {
        type: 'group',
        content: '',
        display: 'grid',
        children: games.map((g): TerminalLine => ({
            type: 'card',
            cardTitle: g.name,
            image: g.image,
            imageAlt: g.name,
            content: '',
            cardWidth: 1,
            cardFloat: 'center',
            children: [
                {
                    type: 'button',
                    content: '(&icon, proicons:game) (&white)Play(&)',
                    href: g.url,
                    style: 'primary',
                    textStyle: 'center',
                }
            ]
        }))
    },

    { type: 'blank', content: '' },

    { type: 'divider', content: 'TV Shows', id: 'shows' },
    {
        type: 'group',
        content: '',
        display: 'grid',
        children: shows.map((s): TerminalLine => ({
            type: 'card',
            cardTitle: s.name,
            content: '',
            cardWidth: 1,
            cardFloat: 'center',
            link: s.imdburl,
            children: [
                { type: 'output', content: `Rating: (&accent)${s.rating}(&)` }
            ]
        }))
    },

    { type: 'blank', content: '' },

    { type: 'divider', content: 'Movies', id: 'movies' },
    {
        type: 'group',
        content: '',
        display: 'grid',
        children: movies.map((m): TerminalLine => ({
            type: 'card',
            cardTitle: m.name,
            content: '',
            cardWidth: 1,
            cardFloat: 'center',
            link: m.imdburl,
            children: [
                { type: 'output', content: `Rating: (&accent)${m.rating}(&)` }
            ]
        }))
    },

    { type: 'blank', content: '' },

    // { type: 'divider', content: 'Music Recommendations', id: 'music' },

    // { 
    //     type: 'group',
    //     content: '',
    //     groupDirection: 'row',
    //     children: [
    //         { type: 'output', content: '(&accent)Artists:(&) ', inline: true },
    //         ...artist.flatMap((a, i): TerminalLine[] => {
    //             const item: TerminalLine = { type: 'link', content: `(&primary)${a.name}(&)`, href: a.url, inline: true };
    //             return i < artist.length - 1 ? [item, { type: 'output', content: ' (&muted)•(&) ', inline: true }] : [item];
    //         }),
    //     ]
    // },

    // { type: 'blank', content: '' },
    // {
    //     type: 'card',
    //     id: 'music-player',
    //     content: '',
    //     mobile: false,
    //     children: [
    //         { type: 'info', content: 'Loading playlist...' }
    //     ]
    // },
    // { type: 'blank', content: '' }
];
