<?php

namespace Database\Seeders;

use App\Models\Project;
use App\Models\Skill;
use Illuminate\Database\Seeder;

class SkillProjectSeeder extends Seeder
{
    public function run(): void
    {
        $skycel = Project::where('slug', 'skycel-portfolio')->first();
        $ecommerce = Project::where('slug', 'ecommerce-app')->first();
        $dashboard = Project::where('slug', 'analytics-dashboard')->first();

        // Skycel Portfolio: Vue.js, Nuxt, Laravel, TailwindCSS, Git
        $skycel->skills()->attach(Skill::where('slug', 'vuejs')->first()->id, [
            'level_before' => 2,
            'level_after' => 4,
            'level_description_key' => 'skill_project.skycel-portfolio.vuejs.level_description',
        ]);
        $skycel->skills()->attach(Skill::where('slug', 'nuxt')->first()->id, [
            'level_before' => 0,
            'level_after' => 3,
            'level_description_key' => 'skill_project.skycel-portfolio.nuxt.level_description',
        ]);
        $skycel->skills()->attach(Skill::where('slug', 'laravel')->first()->id, [
            'level_before' => 2,
            'level_after' => 3,
            'level_description_key' => 'skill_project.skycel-portfolio.laravel.level_description',
        ]);
        $skycel->skills()->attach(Skill::where('slug', 'tailwindcss')->first()->id, [
            'level_before' => 1,
            'level_after' => 3,
            'level_description_key' => 'skill_project.skycel-portfolio.tailwindcss.level_description',
        ]);
        $skycel->skills()->attach(Skill::where('slug', 'git')->first()->id, [
            'level_before' => 3,
            'level_after' => 4,
            'level_description_key' => null,
        ]);

        // E-commerce App: Laravel, Vue.js, PHP, Docker
        $ecommerce->skills()->attach(Skill::where('slug', 'laravel')->first()->id, [
            'level_before' => 1,
            'level_after' => 2,
            'level_description_key' => 'skill_project.ecommerce-app.laravel.level_description',
        ]);
        $ecommerce->skills()->attach(Skill::where('slug', 'vuejs')->first()->id, [
            'level_before' => 1,
            'level_after' => 2,
            'level_description_key' => 'skill_project.ecommerce-app.vuejs.level_description',
        ]);
        $ecommerce->skills()->attach(Skill::where('slug', 'php')->first()->id, [
            'level_before' => 2,
            'level_after' => 3,
            'level_description_key' => null,
        ]);
        $ecommerce->skills()->attach(Skill::where('slug', 'docker')->first()->id, [
            'level_before' => 0,
            'level_after' => 1,
            'level_description_key' => null,
        ]);

        // Analytics Dashboard: TypeScript, Node.js, Git
        $dashboard->skills()->attach(Skill::where('slug', 'typescript')->first()->id, [
            'level_before' => 1,
            'level_after' => 3,
            'level_description_key' => 'skill_project.analytics-dashboard.typescript.level_description',
        ]);
        $dashboard->skills()->attach(Skill::where('slug', 'nodejs')->first()->id, [
            'level_before' => 1,
            'level_after' => 2,
            'level_description_key' => 'skill_project.analytics-dashboard.nodejs.level_description',
        ]);
        $dashboard->skills()->attach(Skill::where('slug', 'git')->first()->id, [
            'level_before' => 2,
            'level_after' => 3,
            'level_description_key' => null,
        ]);
    }
}
