<?php

namespace Database\Seeders;

use App\Models\Testimonial;
use App\Models\Translation;
use Illuminate\Database\Seeder;

class TestimonialSeeder extends Seeder
{
    public function run(): void
    {
        $testimonials = [
            [
                'name' => 'Marie Dupont',
                'role' => 'CTO',
                'company' => 'TechStartup',
                'avatar' => null,
                'text_key' => 'testimonial.marie.text',
                'personality' => 'enthousiaste',
                'project_id' => 1,
                'display_order' => 1,
            ],
            [
                'name' => 'Pierre Martin',
                'role' => 'Lead Developer',
                'company' => 'DevAgency',
                'avatar' => null,
                'text_key' => 'testimonial.pierre.text',
                'personality' => 'professionnel',
                'project_id' => 2,
                'display_order' => 2,
            ],
            [
                'name' => 'Sophie Bernard',
                'role' => 'Product Manager',
                'company' => 'InnovateCorp',
                'avatar' => null,
                'text_key' => 'testimonial.sophie.text',
                'personality' => 'sage',
                'project_id' => null,
                'display_order' => 3,
            ],
            [
                'name' => 'Thomas Leroy',
                'role' => 'Freelance Designer',
                'company' => null,
                'avatar' => null,
                'text_key' => 'testimonial.thomas.text',
                'personality' => 'sarcastique',
                'project_id' => null,
                'display_order' => 4,
            ],
        ];

        foreach ($testimonials as $data) {
            Testimonial::create($data);
        }

        // Traductions
        $translations = [
            [
                'key' => 'testimonial.marie.text',
                'fr' => "Travailler avec Célian a été une révélation ! Son approche créative et sa maîtrise technique ont transformé notre projet. Je recommande sans hésitation !",
                'en' => "Working with Célian was a revelation! His creative approach and technical mastery transformed our project. I highly recommend!",
            ],
            [
                'key' => 'testimonial.pierre.text',
                'fr' => "Code propre, architecture solide, communication claire. Célian sait exactement ce qu'il fait et le fait bien.",
                'en' => "Clean code, solid architecture, clear communication. Célian knows exactly what he's doing and does it well.",
            ],
            [
                'key' => 'testimonial.sophie.text',
                'fr' => "Une personne rare qui combine vision produit et excellence technique. Les retours utilisateurs parlent d'eux-mêmes.",
                'en' => "A rare person who combines product vision and technical excellence. User feedback speaks for itself.",
            ],
            [
                'key' => 'testimonial.thomas.text',
                'fr' => "Bon, j'avoue, au début je pensais que les devs ne comprenaient rien au design. Célian m'a prouvé le contraire. Presque agaçant.",
                'en' => "Okay, I admit, at first I thought devs didn't understand design. Célian proved me wrong. Almost annoying.",
            ],
        ];

        foreach ($translations as $t) {
            Translation::updateOrCreate(
                ['lang' => 'fr', 'key_name' => $t['key']],
                ['value' => $t['fr']]
            );
            Translation::updateOrCreate(
                ['lang' => 'en', 'key_name' => $t['key']],
                ['value' => $t['en']]
            );
        }
    }
}
