<?php

namespace Database\Seeders;

use App\Models\Project;
use App\Models\Requirement;
use Illuminate\Database\Seeder;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;

class RequirementSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        //
        $projects = Project::all();

        foreach ($projects as $project) {
            $requirementsData = [
                [
                    'name' => 'User Authentication',
                    'description' => 'User login and registration functionality',
                    'weight' => 0.00
                ],
                [
                    'name' => 'Product Catalog',
                    'description' => 'Display products with categories and filters',
                    'weight' => 0.00
                ],
                [
                    'name' => 'Shopping Cart',
                    'description' => 'Add, remove, and manage items in cart',
                    'weight' => 0.00
                ],
                [
                    'name' => 'Checkout Process',
                    'description' => 'Complete purchase with payment integration',
                    'weight' => 0.00
                ],
                [
                    'name' => 'Order Management',
                    'description' => 'View and manage order history',
                    'weight' => 0.00
                ]
            ];

            foreach ($requirementsData as $reqData) {
                Requirement::factory()->create([
                    'project_id' => $project->id,
                    'name' => $reqData['name'],
                    'description' => $reqData['description'],
                    'rank' => 0,
                    'weight' => $reqData['weight']
                ]);
            }
        }

        $this->command->info('Requirements seeded successfully!');
    }
}
