<?php

namespace Database\Seeders;

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

class NonFunctionalRequirementSeeder extends Seeder
{
    public function run(): void
    {
        $projects = Project::all();
        $nfrTypes = NonFunctionalRequirement::types();

        foreach ($projects as $project) {
            foreach ($nfrTypes as $nfrType) {
                NonFunctionalRequirement::updateOrCreate(
                    [
                        'project_id' => $project->id,
                        'name'       => $nfrType['name'],
                    ],
                    [
                        'description' => $nfrType['description'],
                        'weight'      => 0.00,
                        'rank' => 0,
                    ]
                );
            }
        }

        $this->command->info('✅ Non-functional requirements seeded successfully!');
    }
}
